Is it correct to get input in the place of calling a func in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it correct to get input in the place of calling a func in python?

Eg: peri(L=int(input()) Where peri is a func already defined

1st Dec 2018, 7:19 PM
Josephine Gitanjali
Josephine Gitanjali - avatar
2 Answers
+ 1
Is L a keyword in your function peri()? Then it's a valid syntax. But still, it may be simpler to directly write peri(int(input))
2nd Dec 2018, 5:06 AM
Kishalaya Saha
Kishalaya Saha - avatar
0
It should work. Disadvantage: You can hardly do error handling, like when the user's input isn't intable.
1st Dec 2018, 7:49 PM
HonFu
HonFu - avatar