Skip to content

Commit 14a78ab

Browse files
committed
Added comments and fixed minor changes in Transaction-Joe.py
Added comments to Kids Shapes Toy-Joe.py Changed -0 to 0 in Transaction-Joe.py as well as changed the loop overrun to something more apropriate.
1 parent 22a1fa9 commit 14a78ab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CodeHS/2/9/7/Kid's Shapes Toy-Joe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"""
44
shapeSize = 60
55

6-
def draw_polygon(m_sides, m_color, m_size):
6+
def draw_polygon(m_sides, m_color, m_size): # Passed variables are translated to these member variables as they enter the def
77
pendown()
88
begin_fill()
99
color(m_color)
10-
circle(m_size, 360, m_sides)
10+
circle(m_size, 360, m_sides) # Function draws a circle of m_size, 360 degrees, with m_sides, making full polygons.
1111
end_fill()
1212
penup()
1313

@@ -24,7 +24,7 @@ def draw_circle(m_angle, m_color, m_size):
2424

2525
penup()
2626
setposition(100, (-100 - shapeSize))
27-
draw_polygon(5, "green", shapeSize)
27+
draw_polygon(5, "green", shapeSize) # We pass 5 for the value of sides, green as the color, and shapeSize as the size of our circle
2828
setposition(-100, (100 - shapeSize))
2929
draw_polygon(4, "red", shapeSize)
3030
setposition(100, (100 - shapeSize))

CodeHS/4/3/10/Transaction-Joe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
This program made by Joe
33
"""
44
total_balance = 1000
5-
min_bank = -0
6-
codehs_compiler_cant_underrstand_loops = 0
5+
min_bank = 0
6+
loop_overun_protection = 0
77

8-
while codehs_compiler_cant_underrstand_loops < 20:
8+
while loop_overun_protection < 20:
99
user_input = input("deposit or withdrawal? ")
1010
if user_input == "deposit":
1111
print("Your current balance is $" + str(total_balance))
@@ -21,4 +21,4 @@
2121
print("Your current balance is now $" + str(total_balance))
2222
else:
2323
print("Invalid transaction")
24-
codehs_compiler_cant_underrstand_loops = codehs_compiler_cant_underrstand_loops + 1
24+
loop_overun_protection = loop_overun_protection + 1

0 commit comments

Comments
 (0)