Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Calcular o valor pago das KWh, de acordo com a instalação
- Diego Mendes Rodrigues
- '''
- # Usuário informar a qtd de KWh consumida
- qtd_kwh = 0
- while qtd_kwh <= 0:
- try:
- qtd_kwh = int(input('Quantidade KWh consumida: '))
- except:
- pass
- # Usuário informar o tipo de instalação
- print('\nR - Residencial')
- print('C - Comercial')
- print('I - Industrial')
- while True:
- tipo_instalacao = input('\nTipo de instalação [R-C-I]: ').upper()
- if tipo_instalacao in ['R', 'C', 'I']:
- break
- # Definir o valor pago por hora
- valor_h = 0
- if tipo_instalacao == 'R':
- if qtd_kwh <= 500:
- valor_h = 0.4
- else:
- valor_h = 0.65
- elif tipo_instalacao == 'C':
- if qtd_kwh <= 1000:
- valor_h = 0.55
- else:
- valor_h = 0.60
- elif tipo_instalacao == 'I':
- if qtd_kwh <= 5000:
- valor_h = 0.55
- else:
- valor_h = 0.60
- # Calcular o preço que será pago
- preco_pagar = qtd_kwh * valor_h
- print(f'\nO valor que será pago é R$ {preco_pagar:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement