Skip to content

Commit 662e2f3

Browse files
committed
Fix wording in functions pt 1
1 parent 7e7ce82 commit 662e2f3

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎docs/python-tutorial/chapters/04-built-in-functions-pt-1.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ print(3.14)
3131
print(False)
3232
```
3333

34-
We can also use print variables, which will print out the data present within them!
34+
We can also print variables, this prints out the data present within them.
3535

3636
```python
3737
age = 43
@@ -156,7 +156,8 @@ The sum of 23 and 12 is 35
156156
```
157157

158158
`int_num1 = int(num1)` and `int_num2 = int(num2)` is what we call type casting. We're casting the
159-
input string to an integer, then assigning it to a variable.
159+
input string to an integer, then assigning it to a variable. (Assigning the cast value to a separate
160+
variable is optional and can be omitted.)
160161

161162
Another common way to write the code above is:
162163

@@ -177,9 +178,9 @@ num1 = int(input("Enter the first number: "))
177178
```
178179

179180
Remember that the innermost function is the one that always executes first. In this case, the
180-
`input` function is the one that fires first. Once the user gives an input, the string input
181-
automatically goes to the `int` function, which then converts the input string to an integer and
182-
assigns it to the `num1` variable.
181+
`input` function is the one that fires first. It waits for the user to give an input. After an input
182+
is given, the data transfers to the `int()` function - converting the string data to an integer (if
183+
the input is valid). Finally, the data gets assigned to the variables.
183184

184185
The example above shows you how to convert user input to an integer. In case you want to use
185186
decimals instead of integers, you can type cast it to `float`.

0 commit comments

Comments
 (0)