0

I am not able find where I am missing the logic

I want to print first 10 numbers https://code.sololearn.com/ccjDPU9M593G/?ref=app

29th Jul 2021, 2:21 PM
Raj
3 Respuestas
+ 1
The Python code I see right now in your link is: n=int(input()) i=1 while n>=1 and n<=100: print(i) i=i+1 Do you really want the first 10 numbers always? Wouldn't you prefer whatever number the user entered? Assuming you want to make use of the number entered by the user, the code you want is: n=int(input()) i=1 while i<=n: print(i) i=i+1
29th Jul 2021, 2:27 PM
Josh Greig
Josh Greig - avatar
0
Actually your condition will be true all the time so it will run till infinite times u can simply write n=0 while n<10 PRINT n n+1
29th Jul 2021, 2:30 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Raj Here's a simple possibility: print(*range(1, 11), sep="\n") # Hope this helps
29th Jul 2021, 4:10 PM
Calvin Thomas
Calvin Thomas - avatar