Going to the theater

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


The answer is 22.

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.

1 solution

cost = 7 + 11 = 18 7 + 11 = 18 .

wallet = 40 18 = 22 40 - 18 = 22 .

The final value of wallet is printed out: 22

Good ansar 22

Ayman Jadan - 5 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...