CSC111 Teller.py 2014

From dftwiki3
Jump to: navigation, search

--D. Thiebaut (talk) 12:20, 3 February 2014 (EST)


Teller.py


# Teller machine program
# teller.py
# D. Thiebaut

# initialize
# Amount = 1236
amount = 1236



# compute
# number20s = amount // 20
number20s = amount // 20

# number10s = leftover // 10
leftover1 = amount % 20
number10s = leftover1 // 10

# number5s = leftover // 5
number5s = leftover1 // 5
leftover2 = leftover1 % 10

# number1s = leftover // 1
number1s = leftover2 // 1

# output number20s, number10s, number5s, number1s
print( amount, number20s, number10s, number5s, number1s )

Output

1236 61 1 3 6