Why does this code has error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does this code has error?

Can you please check what is wrong here and why not all arguments can be converted? If number is introduced manually (not through input), the code works. https://code.sololearn.com/cJzJU2ssbx69/?ref=app Thanks in advance :)

28th Oct 2020, 8:36 PM
Blanka
Blanka - avatar
2 Answers
+ 8
You need to convert input to integer, because input returnes all what was entered as string format by default. You can use something like: num = int(input())
28th Oct 2020, 8:42 PM
Lothar
Lothar - avatar
+ 1
Thank you so much
30th Oct 2020, 7:50 PM
Blanka
Blanka - avatar