Hanwool Codes RSS Tag Admin Write Guestbook
2023-01-21 18:00:25

Loops | HackerRank

 

Loops | HackerRank

Practice using "for" and "while" loops in Python.

www.hackerrank.com

 

Goal

 

Read integer value n, and print i² for all non-negative integer i < n.

 

 

Solution

If you know for statement in python, it woul be very easy task.

# Loops

if __name__ == '__main__':
    n = int(input())
    
    for i in range(n):
        print(i * i)
Hanwool Codes. Designed by 코딩재개발.