If you want to type hint a variable that can be either an integer or a float, you would use Union[int, _______].

  • Any
  • float
  • number
  • real
To type hint a variable that can be either an integer or a float, you would use 'Union[int, float]'. The 'Union' type hint allows specifying multiple acceptable types.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *