Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def moeda(p=0, moeda='R$'):
- return f'{moeda} {p:.2f}'.replace('.',',')
- def aumentar(a, va, f):
- pAumentar = (va / 100) * a + a
- if f == True:
- return moeda(pAumentar)
- else:
- return pAumentar
- def diminuir(d, vd, f):
- pDiminuir = d - ((vd / 100) * d)
- if f == True:
- return moeda(pDiminuir)
- else:
- return pDiminuir
- def dobro(d, f):
- dobro = d * 2
- if f == True:
- return moeda(dobro)
- else:
- return dobro
- def metade(m, f):
- resm = m / 2
- if f == True:
- return moeda(resm)
- else:
- return resm
- def resumo(p, aum, redu):
- print(f'A metade de {moeda(p)} é {metade(p, True)}')
- print(f'O dobro de {moeda(p)} é {dobro(p, True)}')
- print(f'Aumentando 10%, temos {aumentar(p, aum, True)}')
- print(f'Reduzindo 13%, temos {diminuir(p, redu, True)}')
- #from moeda import resumo
- p = float(input('Digite um preço: R$ '))
- resumo(p, 80, 35)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement