85.9k views
5 votes
Could someone please help me with on how to ask the user to enter two integer numbers, then between the two numbers inclusive, use a while loop to print the square of each number on the same line deprecated by a space?

I can send an example if needed
(And in edhesive please)

1 Answer

2 votes

In python 3:

number1 = int(input("Enter a number: "))

number2 = int(input("Enter a number: "))

x = number1

while x in range(number1, number2+1):

print(x**2, end=" ")

x += 1

I think this is what you're looking for. Best of luck.

User Ganesha
by
5.5k points