age: int
name: str
height: float
is_human: bool
We can add a colon and then we can specify the data type of this particular input.
def police_check(age: int):
if age > 18:
can_drive = True
else:
can_drive = False
return can_drive
if police_check(18):
print("You may pass")
else:
print("Pay a fine")
def greeting(name: str) -> str:
return 'Hello' + name
def police_check(age: int) -> bool:
if age > 18:
can_drive = True
else:
can_drive = False
return can_drive
if police_check(18):
print("You may pass")
else:
print("Pay a fine")