File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change
1
+ # define the chees_and_crackers function
1
2
def cheese_and_crackers (cheese_count , boxes_of_crackers ):
3
+ # print the number of cheeses
2
4
print "You have %d cheeeses!" % cheese_count
5
+ # print the number of boxes of crackers
3
6
print "You have %d boxes of crackers!" % boxes_of_crackers
7
+ # print a string
4
8
print "Man that's enough for a party!"
9
+ # print a string with a line break
5
10
print "Get a blanket.\n "
6
11
12
+ # print a string
7
13
print "We can just give the function numbers directly:"
14
+ # pass 20, 30 to the cheese_and_crackers function
8
15
cheese_and_crackers (20 , 30 )
9
16
10
-
17
+ # print a string
11
18
print "OR, we can use variables from our script:"
19
+ # set a variable to 10
12
20
amount_of_cheese = 10
21
+ # set a variable to 50
13
22
amount_of_crackers = 50
14
23
24
+ # pass amount_of_cheese and amount_of_crackers variables to cheese_and_crackers function
15
25
cheese_and_crackers (amount_of_cheese , amount_of_crackers )
16
26
17
-
27
+ # print a string
18
28
print "We can even to math inside too:"
29
+ # pass 10 + 20 and 5 + 6 to the cheese_and_crackers function
19
30
cheese_and_crackers (10 + 20 , 5 + 6 )
20
31
21
-
32
+ # print a string
22
33
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
23
35
cheese_and_crackers (amount_of_cheese + 100 , amount_of_crackers + 1000 )
You can’t perform that action at this time.
0 commit comments