Skip to content

Instantly share code, notes, and snippets.

@hbisneto
Created January 31, 2023 20:06
Show Gist options
  • Select an option

  • Save hbisneto/f4d397fe6c895edd34d988e8becad346 to your computer and use it in GitHub Desktop.

Select an option

Save hbisneto/f4d397fe6c895edd34d988e8becad346 to your computer and use it in GitHub Desktop.
Sample application using basics Python structures.
EngineKey = True
while EngineKey == True:
print()
print('=' * 80)
print(">> QUANTIDADE DE ITENS <<")
print('=' * 80)
ItensQtd = int(input("[!]: Quantos itens serão somados: "))
Soma = 0
count = 0
for i in range(ItensQtd):
count += 1
Numero = int(input(f'>> Insira o {count}° número: '))
Soma += Numero
print('=' * 80)
print()
print('=' * 80)
print(">> APLICAR DESCONTO <<")
print('=' * 80)
TemDesconto = str(input("[!]: Gostaria de aplicar desconto [y/N]: "))
if TemDesconto == "Y" or TemDesconto == "y" or TemDesconto == "S" or TemDesconto == "s":
Desconto = int(input(">> Insira uma porcentagem de desconto: "))
ValorTotalDesconto = ((Soma)/100) * Desconto
Total = Soma - ValorTotalDesconto
else:
ValorTotalDesconto = 0
Total = Soma - ValorTotalDesconto
print('=' * 80)
print()
print('=' * 80)
print(">> INFORMAÇÕES SOBRE A COMPRA <<")
print('=' * 80)
print(f'Valor da compra: R$ {Soma}')
print(f'Valor com desconto: R$ {Total}')
print('=' * 80)
print()
ExecutarNovamente = str(input("[!]: Gostaria de Executar o programa novamente? [Y/n]: "))
if ExecutarNovamente == "Y" or ExecutarNovamente == "y" or ExecutarNovamente == "S" or ExecutarNovamente == "s":
pass
else:
EngineKey = False
print("\n[Finalizando Aplicação...]\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment