Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f87e0d

Browse files
committed
Add solutions to section 2 exercises
1 parent07c7fce commit8f87e0d

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
Lines changed: 2 additions & 0 deletions
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
Lines changed: 6 additions & 0 deletions
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+
defarea(length,width):
6+
returnlength*width
Lines changed: 6 additions & 0 deletions
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+
defshout(string):
6+
returnstring.upper()
Lines changed: 11 additions & 0 deletions
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+
fromhelpers.stringimportshout
5+
fromhelpers.mathimportarea
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)

[8]ページ先頭

©2009-2025 Movatter.jp