Skip to content

Commit 1d01778

Browse files
committed
extra credit - added comments to each line
1 parent 3dc901c commit 1d01778

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ex19.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1+
# define the chees_and_crackers function
12
def cheese_and_crackers(cheese_count, boxes_of_crackers):
3+
# print the number of cheeses
24
print "You have %d cheeeses!" % cheese_count
5+
# print the number of boxes of crackers
36
print "You have %d boxes of crackers!" % boxes_of_crackers
7+
# print a string
48
print "Man that's enough for a party!"
9+
# print a string with a line break
510
print "Get a blanket.\n"
611

12+
# print a string
713
print "We can just give the function numbers directly:"
14+
# pass 20, 30 to the cheese_and_crackers function
815
cheese_and_crackers(20, 30)
916

10-
17+
# print a string
1118
print "OR, we can use variables from our script:"
19+
# set a variable to 10
1220
amount_of_cheese = 10
21+
# set a variable to 50
1322
amount_of_crackers = 50
1423

24+
# pass amount_of_cheese and amount_of_crackers variables to cheese_and_crackers function
1525
cheese_and_crackers(amount_of_cheese, amount_of_crackers)
1626

17-
27+
# print a string
1828
print "We can even to math inside too:"
29+
# pass 10 + 20 and 5 + 6 to the cheese_and_crackers function
1930
cheese_and_crackers(10 + 20, 5 + 6)
2031

21-
32+
# print a string
2233
print "And we can combine the two, variables and math:"
34+
# pass the amount of cheese variable + 100 and the amount_of_crackers variable + 1000 to the cheese_and_crackers function
2335
cheese_and_crackers(amount_of_cheese + 100, amount_of_crackers + 1000)

0 commit comments

Comments
 (0)