While you're at it: odd printing



Using my code, the only numbers that get printed are 1,9, and 49. Then, I receive a message saying “Oops, try again. Make sure you print out all the numbers from 1 to 10 (inclusive)”. Please help. Thank you!

It would be great if somebody could help me figure out how to make the program square all the numbers from 1-10 using the while loop.


num = 1

while num <= 10:  
    print num**2
    num += num + 1


Fixed! Thanks to anybody who wanted to help.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.