Skip to content

Commit 8e767ba

Browse files
committed
Merge branch 'fix-python-tutorial-input'
2 parents 336f981 + a717587 commit 8e767ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tutorials/python.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ Exercises: Variables and Mathematics
112112

113113
### Average calculator ###
114114

115-
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`.
115+
The first two lines of this program put two numbers entered by the user into variables `a` and `b`.
116+
Replace the comment with code that averages the numbers and puts them in a variable called `average`.
116117

117118
~~~~~ python
118-
a = input("Enter first number: ")
119-
b = input("Enter second number: ")
119+
a = float(input("Enter first number: "))
120+
b = float(input("Enter second number: "))
120121

121122
# Store the average of a and b in the variable `average`
122123

0 commit comments

Comments
 (0)