Changes between Version 11 and Version 12 of ControlSystems/SoftwareTeam/IntroToPython
- Timestamp:
- Sep 4, 2017, 4:34:14 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/IntroToPython
v11 v12 36 36 And, boom, now you're a programmer. The rest is just more details. This is the end of Lesson 1. 37 37 38 38 39 = Lesson 2: More Things To Do = 39 Now "Hello World" is not too exciting if you want to program robots, but its important. It is a program, albeit a short one. We showed you how to run a function (or verb) print, which does something with its argument A, where Ais assigned the value "Hello World".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". 40 41 41 42 If you want to do more, we need to introduce control structures. Take the program below. 42 43 43 Location = 'HERE' 44 45 IF (location == 'HERE') THEN 46 47 Print "We're here! Come on in' 48 49 ELSE 50 51 Print "Go away, we're out eating tacos" 52 53 ELSEIF 44 {{{ 45 #!python 46 location = 'HERE' 47 print("Welcome to our store\n") 48 if location == 'HERE': 49 print("We're here! Come on in\n") 50 else: 51 print("Go away, we're out eating tacos\n") 52 print("Hope you had a good time") 53 }}} 54 54 55 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.