+ 1

How to make a Counter with user input

How to Make a counter with user input like Max number Timer / Time Etc This is the Current Code i = 1 while i <=10 : print(i) i = i + 1 print("Done!") I Tried it with i = 1 b = input(" Enter the max number : ") while i <=b : print(i) i = i + 1 print("Done!") But it's not working

26th Aug 2019, 6:06 AM
Denis kretz
Denis kretz - avatar
3 Antworten
+ 5
b = int(input())
26th Aug 2019, 6:18 AM
Diego
Diego - avatar
+ 5
In python, data received using the input() method is always considered as 'String' . So, the user has to convert it into appropriate type. In ur case, it shall be converted to 'int' as mentioned by Diego...
26th Aug 2019, 6:49 AM
Kuri
Kuri - avatar
+ 1
Thanks
26th Aug 2019, 6:57 AM
Denis kretz
Denis kretz - avatar