Python Loops - Hacker Rank Solution

Hello coders, today we will be solving Python Loops Hacker Rank Solution.

Hello coders, today we will be solving Python Loops Hacker Rank Solution.

Python Loops

👊 Table Of Contents

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.

Constrains

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 - Loops - Hacker Rank Solution

Python 3

for i in range(int(input())):
    print( i ** 2)
Python Loops - Hacker Rank Solution
Python Loops

Disclaimer: The above problem is generated by Hackerrank but the solution is given by Sloth coders. If you have any doubt regarding the Loops Hacker rank Solution, feel free to contact in the Comment section.

Happy Coding!!

A Sloth Who loves to code

Also Read:

Sloth Coders is a Learning Platform for Coders, Programmers and Developers to learn from the basics to advance of Coding of different langauges(python, Java, Javascript and many more).

Post a Comment