Changes between Version 12 and Version 13 of ControlSystems/SoftwareTeam/IntroToPython


Ignore:
Timestamp:
Sep 4, 2017, 4:46:21 PM (8 years ago)
Author:
cdelgigante
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/IntroToPython

    v12 v13  
    11Prerequisites: [wiki:SoftwareOverviewControl Control Systems Overview]
     2
    23----
    3 
    44= Lesson 1:  Getting Started =
    55If you want to tell a computer to do something, you have to communicate with the computer in a programming ''language''.  When we say language, we mean it.   A language has words and grammar and everything else, just like French.
     
    2727print(a)
    2828}}}
    29 This tells the computer to print, you guessed it, "Hello World" on the screen.
     29This tells the computer to print, you guessed it, "Hello World"  
    3030
    31 Now you try it:   Go [https://www.tutorialspoint.com/execute_python3_online.php here].   Its our code editor for this training exercise.   You can enter code in the center area of the page, click execute, and see the results below.  I recommend you bookmark that site, its pretty cool.  Now on that site, highlight all the text in the central area and hit back space (this we'll clear out all the sample code.   We'll call this "clear out the test code" from now on.   Then highlight the code above, and click copy, and paste the two lines above into that editor.   Then click "Execute".  (We'll call this series of actions "run the code" from now on.   After a bit, you'll  be rewarded with the message in the bottom window:
     31Now you try it: Do the following:
     32
     33 1. Highlight all the text in the central area and hit back space (this'll we'll clear out all the sample code.)   
     34 1. Then highlight the code above, right click and click {{{Copy}}.
     35 1. Go [https://www.tutorialspoint.com/execute_python3_online.php here].  This site is our code editor, and its pretty cool.  You can put code in the center section, and click execute to run it.  The lower windo
     36
     37
     38
     39|| || || ||
     40|| || || ||
     41
     42 1. w shows the results.    
     43 1. Highlight all the code already in the center window.
     44 1. Right click and pick !{{{Paste}}}.  This should replace everything in the window with the contents above
     45 1. Click !{{{Execute}}} right above the center window.
     46
     47(From now on, we'll call this step "''Go [https://www.tutorialspoint.com/execute_python3_online.php here] and run the code above''".  (Just come back to these steps  if you forget how to do this).  
     48
     49After a bit, you'll  be rewarded with the message in the bottom window:
    3250
    3351{{{
     
    3654And, boom, now you're a programmer.  The rest is just more details.   This is the end of Lesson 1.
    3755
    38 
    3956= Lesson 2:  More Things To Do =
    40 In 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 (show on the screen the value of its argument {{{a}}}, where {{{a}}} is assigned the value "Hello World".
     57In 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 (show on the screen the value of its argument `a`, where `a` is assigned the value "Hello World".
    4158
    4259If you want to do more, we need to introduce control structures.  Take the program below.
    4360
    4461{{{
    45 #!python
    4662location = 'HERE'
    4763print("Welcome to our store\n")
     
    5268print("Hope you had a good time")
    5369}}}
    54 
    55 Cut and paste this program here, then run it (Press Execute).   It should print "We're here! Come on in!".   If it doesn't ask for help.   Spacing matters in Python.
     70Welcome to our store                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          We're here! Come on in                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Hope you had a good time  It should print "We're here! Come on in!".   If it doesn't ask for help.   Spacing matters in Python.
    5671
    5772Now, change line one to Location='Poughkeepsie, NY'.  It should print "Go away, we're out eating tacos".   If I was in Poughkeepsie, I'd be out eating tacos too.  Ummm, tacos.
     
    6883
    6984----
    70 
    7185[[[wiki:ProgrammingReserve Programming]Archive | Programming Archive]]
    72 
    73