Changes between Version 24 and Version 25 of ControlSystems/SoftwareTeam/IntroToPython


Ignore:
Timestamp:
Sep 4, 2017, 5:29:04 PM (8 years ago)
Author:
cdelgigante
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/IntroToPython

    v24 v25  
    8383 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.
    8484
    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.
     85Now, in the editor change the line with the if ''expression'' to
     86{{{
     87if location == 'Poughkeepsie, NY':
     88}}}
     89and 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.
    8690
    8791If 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: