In python while defyning a function is it not necessary to indicate argument type ,like int,str etc., That need to be passed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In python while defyning a function is it not necessary to indicate argument type ,like int,str etc., That need to be passed

8th Jul 2020, 1:13 PM
Chikkala Mohan
Chikkala Mohan - avatar
3 Answers
+ 3
Defining a functions or methods argument type in Python is not required. However, it is possible to apply an argument type hint to a function or method in newer versions (3.5 and newer) of Python. def func(my_var: str): .... .... https://docs.python.org/3/library/typing.html
8th Jul 2020, 1:39 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
We can directly pass the element,no need to define it's type
8th Jul 2020, 1:31 PM
Suren🇮🇳
Suren🇮🇳 - avatar
0
I am asking about indicating parameter type Ex: Def ght(int word) print(word) Is it applicable
8th Jul 2020, 1:20 PM
Chikkala Mohan
Chikkala Mohan - avatar