Skip to content

Commit 80a27ac

Browse files
committed
Merge branch 'more-python-modernisation'
2 parents f529dc6 + 83aa015 commit 80a27ac

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

programming/sr/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ R.wait_start()
117117
~~~~~
118118

119119
During the setup phase, the Robot hardware is inaccessible.
120-
For example,`R.motors` is unavailable since enumerations occurs in the `init` function.
120+
For example, `R.motors` is unavailable since enumerations occurs in the `init` function.
121121
In this phase you can configure how the Robot finds and configures hardware.
122122

123123
After the `init` call, all hardware is accessible.

programming/sr/vision/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The resolution that this image is taken at can be changed using the optional `re
5555

5656
~~~~~ python
5757
# Take a photo at 1280 x 1024
58-
markers = R.see( res=(1280,1024) )
58+
markers = R.see(res=(1280, 1024))
5959
~~~~~
6060

6161
There are currently two kinds of webcam issued with SR kit: the Logitech C500 and C270.

tutorials/python.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ x = 8
8484
my_string = "Tall ship"
8585
~~~~~
8686

87-
You can ask the user to put some text into a variable with the `raw_input` function (we'll cover functions in more detail later):
87+
You can ask the user to put some text into a variable with the `input` function (we'll cover functions in more detail later):
8888

8989
~~~~~ python
90-
name = raw_input("What is your name?")
90+
name = input("What is your name?")
9191
~~~~~
9292

9393
[Concept: Identifiers](#concept-identifiers) {#concept-identifiers}
@@ -104,7 +104,7 @@ Exercises: Variables and Mathematics
104104

105105
### Average calculator ###
106106

107-
The first two lines of this program put two numbers entered by the user into variables `a` and `b`. (The `input` function is like `raw_input`, but returns a number (e.g. `42`) when you enter one, rather than a string (like `"42"`).) Replace the comment with code that averages the numbers and puts them in a variable called `average`.
107+
The first two lines of this program put two numbers entered by the user into variables `a` and `b`. (The `input` function is like `input`, but returns a number (e.g. `42`) when you enter one, rather than a string (like `"42"`).) Replace the comment with code that averages the numbers and puts them in a variable called `average`.
108108

109109
~~~~~ python
110110
a = input("Enter first number: ")
@@ -147,7 +147,7 @@ False
147147
`if` statements execute code only if their condition is true. The code to include in the `if` is denoted by a number of indented lines (see the concept section on [code blocks][block]). To indent a line, press the tab key or insert four spaces at the start. You can also include an `else` statement, which is executed if the condition is false. For example:
148148

149149
~~~~~ python
150-
name = raw_input("What is your name?")
150+
name = input("What is your name?")
151151
if name == "Tim":
152152
print("Hello Tim.")
153153
print("You've got an email.")
@@ -206,7 +206,7 @@ In most other programming languages, if you don't indent your code it will run j
206206
A group of consecutive statements that are all indented by the same distance is called a block. `if` statements, as well as functions and loops, all refer to the block that follows them, which must be indented further than that statement. An example is in order. Let's expand the first `if` example:
207207

208208
~~~~~ python
209-
name = raw_input("What is your name?")
209+
name = input("What is your name?")
210210
email = "Bank of Nigeria: Tax Refund"
211211
if name == "Tim":
212212
print("Hello Tim.")
@@ -387,17 +387,17 @@ Exercises: Lists and Loops
387387
Write a program which calculates the average of a list of numbers. You can specify the list in the code.
388388

389389
**Extension:**
390-
You can tell when a user has not entered anything at a `raw_input` prompt when it returns the empty string, `""`. Otherwise, it returns a string (like "42.5"), which you can turn into a number with the `float` function. For example:
390+
You can tell when a user has not entered anything at a `input` prompt when it returns the empty string, `""`. Otherwise, it returns a string (like "42.5"), which you can turn into a number with the `float` function. For example:
391391

392392
~~~~~ python
393-
var = raw_input("Enter a number: ")
393+
var = input("Enter a number: ")
394394
if var == "":
395395
print("You didn't enter anything!")
396396
else:
397-
print("You entered",float(var))
397+
print("You entered", float(var))
398398
~~~~~
399399

400-
Now, extend your program to let the user enter the list of values. Stop asking for new list entries when they do not enter anything at the `raw_input` prompt.
400+
Now, extend your program to let the user enter the list of values. Stop asking for new list entries when they do not enter anything at the `input` prompt.
401401

402402
### Fizz buzz ###
403403

0 commit comments

Comments
 (0)