Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 16b8e74

Browse files
committedMay 21, 2017
4.1 Addition Lesson
1 parent 8f8796e commit 16b8e74

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
 

‎challenges/4.1.Addition/lesson.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Python Addition
2+
3+
In Python, an integer (int) is one of 3 distinct numeric types.
4+
- https://docs.python.org/3.6/library/stdtypes.html#numeric-types-int-float-complex
5+
6+
In this exercise, you will add two integers using the plus (+) operator.
7+
- https://docs.python.org/3.6/library/operator.html#operator.add
8+
- https://docs.python.org/3/library/operator.html#mapping-operators-to-functions
9+
```
10+
>>> 2 + 2
11+
4
12+
```
13+
14+
**_Instructions:_**
15+
**Change the 0 so that total will equal 20.**
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Modify the code below ###
2+
3+
total = 10 + 0
4+
5+
### Modify the code above ###
6+
7+
print(total)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import unittest
2+
import lesson_code
3+
4+
class AdditionTests(unittest.TestCase):
5+
def test_main(self):
6+
total = lesson_code.total
7+
self.assertIsInstance(total, int)
8+
self.assertEqual(total, 20)
9+
10+
# To run the tests from the console:
11+
# Make sure that you are in the 'addition' directory
12+
# ⇒ python3 -m unittest lesson_tests

0 commit comments

Comments
 (0)
Please sign in to comment.