1 Answer
+ 4
Assuming you are referring to the return type of Python functions...
Functions in Python don't technically have a return type. Okay, well, they do, but you don't need to specify it, unlike other languages. For example:
def f(num):
result = 1
for count in range(1, num+1):
result *= count
return result
Here, it is implied the return type is int, considering result is an int and it's type is not changed. Or, you could do this:
def f(num):
result = "1"
for count in range(1, num+1):
result *= count
return result
The return type is now a string, because result is a string, and it is returned, hence the return type is a string. That about sums it up. Hope this helped. đ