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? | Sololearn: Learn to code for FREE!
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

16th Aug 2021, 10:42 PM
Herbert Ink
Herbert Ink - avatar
4 Answers
+ 1
the variable 'enter' is a string. but you use a comparison operator with an integer and a string.
16th Aug 2021, 10:44 PM
Slick
Slick - avatar
+ 1
Thanks Slick, You can check in your direct messages
16th Aug 2021, 10:55 PM
Herbert Ink
Herbert Ink - avatar
+ 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()
17th Aug 2021, 1:54 AM
Python Learner
Python Learner - avatar
+ 1
The code runs cool in phyCharm IDE
22nd Aug 2021, 11:47 AM
Herbert Ink
Herbert Ink - avatar