Warm-up: reading a while loop

posted by: Ms. Martin 3 April 2011 No Comment
x = 1
while(x < 100):
    x = x + x
    print(str(x) + " ")

 

What is the output produced by the code above?

How many times does the while loop run?

Why is there a call on the str function?

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>