Skip to content

Commit 8000ccb

Browse files
authored
Merge Joe's Branch into master (#1)
Merge Joe's Branch into master
2 parents cccb90f + 1040614 commit 8000ccb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

CodeHS/3/5/9/recipe.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
This program made by Joe S
3+
"""
4+
5+
servings = -1
6+
shopping_list = ["mixed greens", "blueberries", "walnuts"]
7+
8+
object_list = []
9+
10+
class ingredient():
11+
def __init__(self, name, qty):
12+
self.name = name
13+
self.qty = qty
14+
def list_total(self):
15+
print("Total ounces of " + self.name + ": " + str(float(self.qty) * servings))
16+
17+
for listitem in shopping_list:
18+
print("Enter ingredient 1: " + str(listitem))
19+
object_list.append(ingredient(listitem, input("Ounces of " + str(listitem) + ": ")))
20+
21+
servings = float(input("Enter total number of servings: "))
22+
print("")
23+
for item in object_list:
24+
item.list_total()

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# CRTC-Python-Examples
22
A repo for adding in your example python code to assist or impress others! :3
3+
4+
Rules for adding:
5+
Please first create your own branch, then create a pull request from your branch, into the master branch, you can request reviews from certain people, but this is not necessary, people will review your pull request ASAP.
6+
7+
File Structure:
8+
Please arrange your CodeHS examples nested in folders based off unit, so for example, lesson number `3.4.5` would be `/CodeHS/3/4/5/my_python_program.py`

0 commit comments

Comments
 (0)