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
|
1529 Discussions
|
Please Login in order to post a comment
if name == 'main': n = int(input())
n = int(input().strip()) T = [i ** 2 for i in range(n)] for sq in T: print(sq)
Explanation: loop is starting from 0 and printing till n i.e whatever no. we are providing and pow is the function known as power is used.
for x in range(0,5): print(x**2)