Skip to content

Commit 8f87e0d

Browse files
committed
Add solutions to section 2 exercises
1 parent 07c7fce commit 8f87e0d

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ch 11.2 - Working With Packages
2+
# __init__.py - Part of solution to Exercise 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ch 11.2 - Working With Packages
2+
# helpers/math.py - Part of solution to Exercise 1
3+
4+
5+
def area(length, width):
6+
return length * width
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ch 11.2 - Working With Packages
2+
# helpers/string.py - Part of solution to Exercise 1
3+
4+
5+
def shout(string):
6+
return string.upper()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ch 11.2 - Working With Packages
2+
# main.py - Solution to Exercise 2
3+
4+
from helpers.string import shout
5+
from helpers.math import area
6+
7+
8+
length = 5
9+
width = 8
10+
message = f"The area of a {length}-by-{width} rectangle is {area(length, width)}"
11+
print(shout(message))

0 commit comments

Comments
 (0)