|
1 | | -# Elabore um programa que calcule o valor a ser pago por um produto, considerando o seu preço normal e |
2 | | -# condição de pagamento: – à vista dinheiro/cheque: 10% de desconto |
3 | | -#– à vista no cartão: 5% de desconto |
4 | | -#– em até 2x no cartão: preço formal |
5 | | -#– 3x ou mais no cartão: 20% de juros |
6 | | -preco = float(input('Preço das compras: R$')) |
7 | | -print(''' FORMAS DE PAGAMENTO: |
8 | | -[ 1 ] à vista dinheiro/pix |
9 | | -[ 2 ] à vista cartão |
10 | | -[ 3 ] 2x no cartão |
11 | | -[ 4 ] 3x ou mais no cartão''') |
12 | | -opcao = int(input('Qual a sua opção?')) |
13 | | -if opcao == 1: |
14 | | - total = preco - (preco * 0.10) |
15 | | -elif opcao == 2: |
16 | | - total = preco - (preco * 0.05) |
17 | | -elif preco == 3: |
18 | | - total = preco |
19 | | - parcela = total / 2 |
20 | | - print('Sua compra será parcelada em 2x de R${:.2f} SEM JUROS.'.format(parcela)) |
21 | | -elif opcao == 4: |
22 | | - total = preco + (preco * 0.20) |
23 | | - totparc = int(input('Quantas parcelas?')) |
24 | | - parcela = total / totparc |
25 | | - print('Sua compra será parcelada em {}x de R${:.2f}.'.format(totparc, parcela)) |
26 | | -print('Sua compra de R${:.2f} vai custar R${:.2f} no final.'.format(preco, total)) |
| 1 | +# Develop a program that calculates the amount to be paid for a product, considering its normal price and |
| 2 | +# payment conditions: – cash/check: 10% discount |
| 3 | +#– cash on card: 5% discount |
| 4 | +#– up to 2x on card: formal price |
| 5 | +#– 3x or more on card: 20% interest |
| 6 | +price = float(input('Purchase price:')) |
| 7 | +print(''' PAYMENT METHODS: |
| 8 | +[ 1 ] cash/pix in cash |
| 9 | +[ 2 ] cash card |
| 10 | +[ 3 ] 2x on card |
| 11 | +[ 4 ] 3x or more on card''') |
| 12 | +option = int(input('What is your option?')) |
| 13 | +if option == 1: |
| 14 | + total = price - (price * 0.10) |
| 15 | +elif option == 2: |
| 16 | + total = price - (price * 0.05) |
| 17 | +elif price == 3: |
| 18 | + total = price |
| 19 | + installment = total / 2 |
| 20 | + print(f'Your purchase will be paid in 2 installments of U${installment:.2f}interest free.') |
| 21 | +elif option == 4: |
| 22 | + total = price + (price * 0.20) |
| 23 | + total_installment = int(input('How many installments?')) |
| 24 | + installment = total / total_installment |
| 25 | + print(f'Your purchase will be paid in installments {total_installment}x of U${installment:.2f}.') |
| 26 | +print(f'Your purchase of U${price:.2f} it will cost U${total:.2f}.') |
0 commit comments