Hello coders, today we are going to solve Python Loops Hacker Rank Solution.
![Python Loops - Hacker Rank Solution](https://www.codingbroz.com/wp-content/uploads/2021/03/python-loops-hackerrank-solution-codingbroz.png)
Task
The provided code stub reads and integer, n, from STDIN. For all non-negative integers i < n, print i2 .
Example
n = 3
The list of non-negative integers that are less than n = 3 is [ 0, 1, 2 ]. Print the square of each number on a separate line.
0
1
4
Input Format
The first and the only line contains the integer, n.
Constraints
1 ≤ n ≤ 20
Output Format
Print n lines, one corresponding to each i.
Sample Input 0
5
Sample Output 0
0
1
4
9
16
Solution – Python Loops Hacker Rank Solution
if __name__ == '__main__': n = int(input()) for i in range(0, n): print(i ** 2)
Disclaimer: The above Problem (Python Loops) is generated by Hacker Rank but the Solution is provided by CodingBroz. This tutorial is only for Educational and learning purposes.
if n >= 0:
for i in range (0,n):
print (i**2)
n=int(input())
for i in range(n):
print(i*i)
n = int(input())
for i in range(n)
print(i**2)
n = int(input())
a = 5
for a in range(0 ,5):
print(a**2)
a=int(input())
for i in range(0,a):
print(i**2)
for i in range(5):
print(i*i)