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
+ 0 comments for i in range(n): square = i * i print(square)
+ 0 comments num = [] if name == 'main': n = int(input()) i = 0 for a in range(0,n): num.append(i) i += 1 for b in num: if b < n: print(b**2)
+ 0 comments n = int(input()) if n in range(1, 21): for i in range(n): print(pow(i, 2))
+ 0 comments I believe that this approach is not only straightforward but also easy to understand.
n = int(input()) for i in range(n): i = i ** 2 print(i)
+ 0 comments I thought this would be more simpler
n = int(input()) i = 0 while i < n: print(i * i) i = i + 1
Load more conversations
Sort 1415 Discussions, By:
Please Login in order to post a comment