@@ -14,7 +14,7 @@ it a name then set its value.
1414
1515Now in the REPL type:
1616
17- >>> year = 2016
17+ >>> year = 2016
1818
1919In this example you have now stored the value ` 2016 ` into the variable ` year ` .
2020See what happens next when you type `year' into the REPL. Does it show it back
@@ -30,9 +30,9 @@ variables with the maths operations we learnt in the previous tutorial.
3030
3131Now in the REPL type the following:
3232
33- >>> revenue = 1000
34- >>> costs = 200
35- >>> profit = revenue - costs
33+ >>> revenue = 1000
34+ >>> costs = 200
35+ >>> profit = revenue - costs
3636
3737Now type ` profit ` to see the results of this calculation.
3838
@@ -49,22 +49,22 @@ strings.
4949
5050Now in the REPL type:
5151
52- >>> name = 'codebar'
53- >>> url = "codebar.io"
52+ >>> name = 'codebar'
53+ >>> url = "codebar.io"
5454
5555Now type ` name ` and ` url ` to see these strings shown back to you. As you can
5656see Python allows both single and double quotes to denote a string variable.
5757Double quotes are required if there is going to be an apostrophe in the string.
5858
5959For example:
6060
61- message = "I'm a string"
61+ message = "I'm a string"
6262
6363Sometimes you will need to use an apostrophe within a single quote, on
6464occasions like this it is recommended to use "string escaping". This would look
6565like:
6666
67- message ='I\'m a string'
67+ message ='I\'m a string'
6868
6969Try storing a string within a variable without quotes, see what happens?
7070Numbers do not require quotation marks, whereas they are mandatory for storing
@@ -122,20 +122,20 @@ command. Let's create a variable in which to store the user input.
122122
123123Now type this into your REPL:
124124
125- >>> lucky_number = input("What is your lucky number? ")
125+ >>> lucky_number = input("What is your lucky number? ")
126126
127127Type back your answer after it asks you.
128128
129129Now in the REPL type:
130130
131- >>> food = input("What is your favourite food? ")
131+ >>> food = input("What is your favourite food? ")
132132
133133Now we are going to put your response into another variable.
134134
135135Now try:
136136
137- >>> my_name = input("What is your name? ")
138- >>> greeting = "Hello " + my_name
137+ >>> my_name = input("What is your name? ")
138+ >>> greeting = "Hello " + my_name
139139
140140Then type ` greeting ` into your REPL to receive your message.
141141
0 commit comments