New course! Every coder should learn Generative AI!
Try a free lesson+ 1
Why is my code for solving a code project on strings Python for Beginners brings an error on run in the SoloLearn built-in IDE?
You need to make a program for a leaderboard. The program needs to output the numbers 1 to 9, each on a separate line, followed by a dot: 1. 2. 3. https://code.sololearn.com/cNuusRppxOtu/?ref=app
4 Answers
+ 1
the variable 'enter' is a string. but you use a comparison operator with an integer and a string.
+ 1
Thanks Slick,
You can check in your direct messages
+ 1
Hi Herbert!
It shows an error because, this code project doesn't take any input from the users(or input is empty string). Inorder to solve this problem you have to hardcode your solution. For that, you can replace input() to a direct value 1(enter = 1).
Here it is your working code.
while True :
enter = 1
if not 0 < enter < 10:
print ("Enter digit between 0 and 10")
continue
while True :
if 0 < enter < 10:
print (f"{enter }.")
enter = enter + 1
continue
break
break
exit()
+ 1
The code runs cool in phyCharm IDE