Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resto = float(input())
- list_stot = []
- resto_l = 0
- leva_1 = 0
- leva_2 = 0
- leva = int(resto)
- stotinki = round((resto - leva) * 100)
- # Ресто в левови монети
- leva_2 = 0
- leva_1 = 0
- stot_50 = 0
- stot_20 = 0
- stot_10 = 0
- stot_5 = 0
- stot_2 = 0
- stot_1 = 0
- if not leva:
- resto_l = 0
- elif leva == 1:
- leva_1 = 1
- elif leva == 2:
- leva_2 = 1
- elif leva > 2:
- if not leva % 2:
- leva_2 = leva / 2 # брой монети по 2 лева и готово
- elif leva // 2 > 0:
- leva_2 = leva // 2
- leva_1 = leva % 2
- #print(f"{leva_2} монети по 2 лева и {leva_1} монети по 1 лев")
- # print(stotinki)
- stot_50 = stotinki // 50
- list_stot.append(stot_50)
- ostatak = stotinki - 50 * list_stot[0]
- stot_20 = ostatak // 20
- list_stot.append(stot_20)
- ostatak = ostatak - 20 * list_stot[1]
- stot_10 = ostatak // 10
- list_stot.append(stot_10)
- ostatak = ostatak - 10 * list_stot[2]
- stot_5 = ostatak // 5
- list_stot.append(stot_5)
- ostatak = ostatak - 5 * list_stot[3]
- stot_2 = ostatak // 2
- list_stot.append(stot_2)
- ostatak = ostatak - 2 * list_stot[4]
- stot_1 = ostatak
- list_stot.append(stot_1)
- #print(list_stot)
- # print(f"{list_stot[0]} по 50 ст, {list_stot[1]} по 20 ст, {list_stot[2]} по 10 ст, {list_stot[3]} по 5 ст, {list_stot[4]} по 2 ст, {list_stot[5]} по 1 ст")
- count_coin = leva_2 + leva_1 + stot_50 + stot_20 + stot_10 + stot_5 + stot_2 + stot_1
- print(count_coin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement