Hello Programmers, In this post, you will know how to solve the Loops in Python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.
One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.
Loops in Python HackerRank Solutions
Problem
The provided code stub reads and integer,n, from STDIN. For all non-negative integers, i < N, print i^2.
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 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
Loops in Python Hacker Rank Solution
if __name__ == '__main__': n = int(input()) for i in range(n): print(i*i)
Disclaimer: The above Problem (Loops in Python) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.