I am using Python 3.6 and would like to define a function that takes two integers a and b and returns their division c = a//b. I would like to enforce the input and output types without using assert. My understanding from what I have found in the documentations and on this site is that one should define this function as such:
def divide(a: int, b: int) -> int:
c = a // b
return c
divide(3, 2.) # Output: 1.0
I was expecting an error (or a warning) since b and c are not integers.
- What is the issue with my particular code?
- How can I specify input and output types correctly without using
assertin general?