Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 49)
49.
How can you print the square of numbers from 1 to 5?
for num in range(1, 6): print(num * num)
print_squares([1, 2, 3, 4, 5])
squares_print(1, 5)
print(range(1, 6) ** 2)
Answer: Option
Explanation:
To print the square of numbers from 1 to 5, use a loop with range(1, 6) and calculate the square with num * num.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.