Advertisement
raiol

Untitled

Jul 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. def moeda(p=0, moeda='R$'):
  2.     return f'{moeda} {p:.2f}'.replace('.',',')
  3.  
  4. def aumentar(a, va, f):
  5.     pAumentar = (va / 100) * a + a
  6.     if f == True:
  7.         return moeda(pAumentar)
  8.     else:
  9.         return pAumentar
  10.  
  11.  
  12. def diminuir(d, vd, f):
  13.     pDiminuir = d - ((vd / 100) * d)
  14.     if f == True:
  15.         return moeda(pDiminuir)
  16.     else:
  17.         return pDiminuir
  18.  
  19.  
  20. def dobro(d, f):
  21.     dobro = d * 2
  22.     if f == True:
  23.         return moeda(dobro)
  24.     else:
  25.         return dobro
  26.  
  27.  
  28. def metade(m, f):
  29.     resm = m / 2
  30.     if f == True:
  31.         return moeda(resm)
  32.     else:
  33.         return resm
  34.  
  35.  
  36. def resumo(p, aum, redu):
  37.     print(f'A metade  de {moeda(p)} é {metade(p, True)}')
  38.     print(f'O dobro de {moeda(p)} é {dobro(p, True)}')
  39.     print(f'Aumentando 10%, temos {aumentar(p, aum, True)}')
  40.     print(f'Reduzindo 13%, temos {diminuir(p, redu, True)}')
  41.  
  42. #from moeda import resumo
  43.  
  44.  
  45. p = float(input('Digite um preço: R$ '))
  46. resumo(p, 80, 35)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement