Skip to main content

shopping_debugging_solution.py


# shopping
a=3   # number of apples
o=0   # number of oranges
print 'you have:    ',a,'apples and ',o,'oranges'
buy_a=4   # apples you buy
buy_o=6   # oranges you buy
print 'you buy:     ',buy_a,'apples and ',buy_o,'oranges'
a=a+buy_a
o=o+buy_o
print 'you now have:',a,'apples and ',o,'oranges'