Function With Return Type
Sat 17 May 2025
title: "Function With Return Type" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
def square(a):
return a * a
print(square(5))
25
def square(a:int) -> int:
return a * a
print(square(4))
16
def square_1(a:int) -> str:
return a * a
print(square_1(15))
225
in the above function, even though we say the return type is string, we are returning an int.
Score: 5
Category: basics