CSC111 Lab 4 2014

From dftwiki3
Revision as of 16:11, 17 February 2014 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =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 cor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--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

QuestionMark3.jpg

Can you make your program only 3 characters longer and make it accept only numbers that are less than 3 or greater than 9?