Changes between Version 142 and Version 143 of ControlSystems/SoftwareTeam/IntroToPython


Ignore:
Timestamp:
Sep 5, 2017, 8:01:50 AM (8 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/IntroToPython

    v142 v143  
    5252
    5353= Lesson 2: Control Structures =
     54[[Image(https://docs.oracle.com/cd/A58617_01/server.804/a58236/03_strua.gif,20%,right)]]
    5455In lesson 1, we had you create a program, "Hello World".  Now, "Hello World" is not too exciting if you want to program robots, but its an important first step.  We showed you how to run a function (or verb) `print`, which does something (shows on the screen the value of its argument `a`, where `a` is assigned the value "Hello World".
    5556
     
    5758
    5859== If-Then-Else:  Decide, already! ==
     60Selective execution of portions of your program is done with ''conditionals''. 
    5961Take the program below, it uses an If-Then-Else control structure to ask the program to make a decision, and run code based on that decision.  You'll use these all the time.
    6062
     
    114116
    115117== For Loop:  Stop Hitting Yourself! ==
    116 The For loop control structure runs code repeats over a variable.  Try running this one:
     118Repeated execution of a portion of your program is done with a type of control structure called an ''iterator''.
     119The For loop control structure runs the same block of code for each item contained in a variable.  Try running this one:
    117120
    118121{{{
     
    193196
    194197= Lesson 3:  Functions =
     198[[Image(https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Function_machine2.svg/220px-Function_machine2.svg.png,right,15%,nolink)]]
    195199So are you tired of just printing stuff yet?   In the last lesson, we introduced you to all sort of ways to make decisions and loop over code to make your program easier to read and shorter too.
    196200