Changes between Version 40 and Version 41 of ControlSystems/SoftwareTeam/IntroToPython
- Timestamp:
- Sep 4, 2017, 6:50:24 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/IntroToPython
v40 v41 140 140 print ("The count is:", count) 141 141 count = count + 1 142 count = count + 1 142 count = count + 1 # Yup, lets do it again because we're E-VIL 143 143 144 144 print("Good bye!") … … 149 149 150 150 }}} 151 Oh no, I'm tired, so I'm not going to tell you the answer for this one. You should be seeing a pattern by now. You tell me--- What should it print? Count starts out at 0, and as long as count is less than 9 it will run the code in the block, then it will print "Good bye!". What else does it print out?151 Oh no, I'm tired, so I'm not going to tell you the answer for this one. You should be seeing a pattern by now. You tell me---what should it print? Count starts out at 0, and as long as count is less than 9 it will run the code in the block, then it will print "Good bye!". What else does it print out? 152 152 153 153 == Bringing it all Together... == … … 165 165 print("score!") 166 166 }}} 167 What does it output? See how the indenting works when nesting? Note that count+=1 is shorthand for count=count+1because not typing those excess characters __could save your life__.167 What does it output? See how the indenting works when nesting? Note that `count+=1` is shorthand for `count=count+1` because not typing those excess characters __could save your life__. 168 168 169 169 Now, modify the code to make it repeat the word potato each time based on the current value of count. For example: