While you're at it: odd printing


#1

Link:
https://www.codecademy.com/courses/python-beginner-en-cxMGf/0/3?curriculum_id=4f89dab3d788890003000096#

Issue:
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.

Code:

num = 1

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



#2

Fixed! Thanks to anybody who wanted to help.


#3

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