CSC111 Lab 4 2014
--D. Thiebaut (talk) 15:11, 17 February 2014 (EST)
Lab on While Loops
First Program
- Observe the program below
- Once you have figured out how it works, enter it in Idle and run it. Verify that it runs correctly.
x = input( "enter an integer between 3 and 9: " )
while 3 <= x <= 9:
print "invalid input!"
x = input( "enter an integer between 3 and 9: " )
print( "x = ", x )
Challenge 1 |
Can you make your program only 3 characters longer and make it accept only numbers that are less than 3 or greater than 9?