Skip to content

Commit 0c6b0cd

Browse files
authored
Update 2. Arithmetic.md
1 parent 498d484 commit 0c6b0cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

1. Your First Code/2. Arithmetic.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44
## We Can Do Math!
55
That's right, it's time for some numbers work. You can do a bunch of math in Python, and easily see it working. For starters, let's add a new line of code to your
66
repl:
7+
###### Example 2.1
78
```python
89
print(2 + 2)
910
```
1011
Run that. What did the console output? I bet it was 4. Was it 4? Dang, I am so good at this. That's right, the print statement accepts numbers and math, too! You can
1112
combine numbers AND text:
13+
###### Example 2.2
1214
```python
1315
print("The United States has" , 25 + 25 , "states!")
1416
```
1517
But Python can do more than just addition. Let's try a few different operations, shall we? How about we start with the four main **operators**:
18+
###### Example 2.3
1619
```python
1720
print(2 + 2)
1821
print(10 / 2)
@@ -21,6 +24,7 @@ print(10 - 5)
2124
```
2225
If you run this code, you may notice that the results are printed, but it's just a bunch of numbers, which are hard to interpret as a reader. Let's add some text
2326
to the print statement using the skills you learned in the last section in order to make the output more readable:
27+
###### Example 2.4
2428
```python
2529
print("2 + 2 =", 2 + 2)
2630
print("10 / 2 =", 10 / 2)
@@ -32,7 +36,7 @@ and `/` for division. But wait a second, why did the stuff in quotes not evaluat
3236
in quotes, so they are read by Python as a "string" type. Let's go on to the next section to discuss those. But first, play around with the arithmetic a bit.
3337

3438
## Further Explorations
35-
###### Here's a few things to try on your own to better understand arithmetic in Python:
39+
###### Here's a few things to try on your own to better understand arithmetic in Python. You can find all of the above examples, as well as solutions to the Further Explorations problems in solutions2.py
3640
```
3741
Use the following information for your exploration problems:
3842
Laura is 6, Jane is 12, Max is 15, George is 22

0 commit comments

Comments
 (0)