0

Some what I'm missing in this problem.. Could you help me?Q:Read an integer N.. For all non negative integers i <N, print i**2.

#My code n = int(raw_input) i = 0 while i <20: i+=1 print(i**2) ""Output should come under 20, but i don't get it """

10th Apr 2020, 5:52 AM
SelvaKumar
5 Antworten
+ 2
n = int(input()) i = 0 while i <n: i+=1 print(i**2) #raw input is python 2 vertion function, In python 3, input() SoloLearn supports python 3..
10th Apr 2020, 6:00 AM
Jayakrishna 🇮🇳
+ 1
when i enter 5.. Output is like 1,4,9,16,25....but is should be 0,1,4,9,16..
10th Apr 2020, 6:03 AM
SelvaKumar
+ 1
Change the order like this print(i**2) i+=1
10th Apr 2020, 6:06 AM
Jayakrishna 🇮🇳
+ 1
Thanks bro.. Its working 😃😃😃
10th Apr 2020, 6:08 AM
SelvaKumar
+ 1
SELVANITHISH SELVANITHISH Observe and understand each line of code.. You're Wel come..
10th Apr 2020, 6:30 AM
Jayakrishna 🇮🇳