We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Introduction
- Loops
- Discussions
Loops
Loops
Sort by
recency
|
1544 Discussions
|
Please Login in order to post a comment
n = int(input()) # Assuming n is always positive for i in range(n): print(i ** 2)
if name == 'main': n = int(input()) for i in range(n): print(i**2)
if name == 'main': n = int(input())
for n in range(n): print(pow(n,2))
a=0 for i in range(n): a=i*i print(a) it's correct
it is simple :- 1. use for loop and for creating list use range function in different line for i in range (n): 2. then use the print (i*i)