-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af0ca27
commit 1d1a21b
Showing
9 changed files
with
134 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from ex107 import moeda0 | ||
n = float(input('Digite um preço: R$')) | ||
print(f'{n} com aumento de 10% é igual a {moeda0.aumentar(n, 10)}') | ||
print(f'{n} menos 10% é igual a {moeda0.diminuir(n, 10)}') | ||
print(f'O dobro de {n} é igual a {moeda0.dobro(n)}') | ||
print(f'A metade de {n} é igual a {moeda0.metade(n)}') |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from ex108 import moeda1 | ||
n = float(input('Digite um preço: R$')) | ||
print(moeda1.moeda(n)) | ||
print(f'{n} com aumento de 10% é igual a {moeda1.moeda(moeda1.aumentar(n, 10))}') | ||
print(f'{n} menos 10% é igual a {moeda1.moeda(moeda1.diminuir(n, 10))}') | ||
print(f'O dobro de {n} é igual a {moeda1.moeda(moeda1.dobro(n))}') | ||
print(f'A metade de {n} é igual a {moeda1.moeda(moeda1.metade(n))}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
''' | ||
Exercício 109: | ||
''' | ||
|
||
|
||
def moeda(n=0, moeda='R$'): | ||
return f'{moeda}{n:.2f}'.replace('.', ',') | ||
|
||
|
||
def aumentar(n=0, a=0, f=True): | ||
c = (n * a) / 100 | ||
l = c + n | ||
if not f: | ||
return l | ||
else: | ||
return moeda(l) | ||
|
||
|
||
def diminuir(n=0, a=0, f=True): | ||
c = (n * a) / 100 | ||
l = n - c | ||
if not f: | ||
return l | ||
else: | ||
return moeda(l) | ||
|
||
|
||
def dobro(n=0, f=True): | ||
d = n * 2 | ||
if not f: | ||
return d | ||
else: | ||
return moeda(d) | ||
|
||
|
||
|
||
def metade(n=0, f=True): | ||
m = n / 2 | ||
if not f: | ||
return m | ||
else: | ||
return moeda(m) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
''' | ||
Exercício 110: | ||
Adicione ao módulo moeda.py criado nos desafios anteriores, | ||
uma função chamada resumo(), que mostre na tela algumas informações | ||
geradas pela funções que já temos no módulo criado até aqui. | ||
''' | ||
|
||
|
||
|
||
def moeda(n=0, moeda='R$'): | ||
return f'{moeda}{n:.2f}'.replace('.', ',') | ||
|
||
|
||
def aumentar(n=0, a=0, f=True): | ||
c = (n * a) / 100 | ||
l = c + n | ||
if not f: | ||
return l | ||
else: | ||
return moeda(l) | ||
|
||
|
||
def diminuir(n=0, a=0, f=True): | ||
c = (n * a) / 100 | ||
l = n - c | ||
if not f: | ||
return l | ||
else: | ||
return moeda(l) | ||
|
||
|
||
def dobro(n=0, f=True): | ||
d = n * 2 | ||
if not f: | ||
return d | ||
else: | ||
return moeda(d) | ||
|
||
|
||
|
||
def metade(n=0, f=True): | ||
m = n / 2 | ||
if not f: | ||
return m | ||
else: | ||
return moeda(m) | ||
|
||
|
||
def resumo(n, a): | ||
print('=' * 30) | ||
print(f' {"RESUMO":^30} ') | ||
print('-' * 30) | ||
print(f'{"- Aumento: ":<5} {aumentar(n, a):>10}') | ||
print(f'{"- Diminuição: ":<5} {diminuir(n, a):>10}') | ||
print(f'{"- Dobro: ":<5} {dobro(n):>10}') | ||
print(f'{"- Metade: ":<5} {metade(n):>10}') | ||
print('=' * 30) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from ex110 import moeda | ||
n = float(input('Digite um preço: R$')) | ||
print(moeda.aumentar(n, 10, f=False)) | ||
print(f'{n} com aumento de 10% é igual a {moeda.aumentar(n, 10)}') | ||
print(f'{n} menos 10% é igual a {moeda.diminuir(n, 10)}') | ||
print(f'O dobro de {n} é igual a {moeda.dobro(n)}') | ||
print(f'A metade de {n} é igual a {moeda.metade(n)}') | ||
moeda.resumo(n, 10) |