0
num = input ("Please enter an amount in euros:")
x = int (num)
print (x)
a = x // 500 # The operations are performed to find how many bills of each heat there is and its residue.
x = x% 500
if not a == 0: # Condition for the value of agreement only in the result of the residue in case none exists.
b = x // 200
x = x% 200
else: b = x // 200
yes no b == 0:
c = x // 100
x = x% 100
else: c = x // 100
if not c == 0:
d = x // 50
x = x% 50
else: d = x // 50
if not d == 0:
e = x // 20
x = x% 20
else: e = x // 20
if it is not e == 0:
f = x/10
x = x% 10
else: f = x // 10
if not f == 0:
g = x // 5
x = x% 5
else: g = x // 5 # I make several conditions that allow me
if not g == 0: #Evaluate the results of each operation
h = x // 2 # immediately above.
x = x% 2
else: h = x // 2
if not h == 0:
i = x // 1
x = x% 1
else: i = x // 1
print ("There", a, "500 euro banknote (s)")
print ("There", b, "ticket (s) of 200 euros")
print ("There", c, "ticket (s) of 100 euros")
print ("There", d, "50 euro banknote (s)") # printout of results
print ("There", and, "ticket (s) of 20 euros")
print ("There", f, "ticket (s) of 10 euros")
print ("There", g, "ticket (s) of 5 euros")
print ("There", h, "currency (s) of 2 euros")
print ("There", i, "currency (s) of 1 euros")
對於我分解方案硬幣數量歐元的我的程序不的你多少張門票有一些歐元計。當執行它時執行條件,如果另一個也執行我。 當它經歷倒數第二個週期時,它也評估我並顯示另一個。我能做些什麼,因爲我想
申請編碼的Python的基礎知識:使用有意義的變量名;學會正確縮進你的代碼;應用DRY原則(不要重複自己:使用函數或循環來重複代碼而不是複製粘貼代碼)。 – agtoever