What does the following python code print out?
# python code start
wallet = 40
hotdog = 3
coke = 2
movie = 11
pretzel = 7
cash_register = 5
cost = pretzel + movie
wallet = wallet - cost
cash_register = cash_register + cost
print wallet
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
cost = 7 + 1 1 = 1 8 .
wallet = 4 0 − 1 8 = 2 2 .
The final value of wallet is printed out: 22