Changes between Version 24 and Version 25 of ControlSystems/SoftwareTeam/IntroToPython
- Timestamp:
- Sep 4, 2017, 5:29:04 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/IntroToPython
v24 v25 83 83 1. You'll see that a few of the print statements end with a {{\\n}}. This is called a ''escape sequence'', and its shorthand for a newline. When the computer sees it in a print statement, it will add an extra line to the output. See here for other escape sequences you can add. 84 84 85 Now, in the editor change the ''condition'' to location=='Poughkeepsie, NY' and run it again. What happens? It should print "Go away, we're out eating tacos". Why? If I was in Poughkeepsie, I'd be out eating tacos too. Yummmm, tacos. 85 Now, in the editor change the line with the if ''expression'' to 86 {{{ 87 if location == 'Poughkeepsie, NY': 88 }}} 89 and run it again. What happens? It should print "Go away, we're out eating tacos". Why? If I was in Poughkeepsie, I'd be out eating tacos too. Yummmm, tacos. 86 90 87 91 If you're writing your own code, you want to the skip the else, just omit the word else: and the indented block below it. For example: