Skip to content

Instantly share code, notes, and snippets.

@cabraljv
Created April 15, 2018 03:24
Show Gist options
  • Save cabraljv/9662306adc22401063cac3e36a3cbe62 to your computer and use it in GitHub Desktop.
Save cabraljv/9662306adc22401063cac3e36a3cbe62 to your computer and use it in GitHub Desktop.
obrigado a todos pela ajuda
print(' ')
print(' \33[1;31m _______ _______ _______ _______ _______ _______ ___ ___ _______ ')
print(' | ___ | | ___ | | ___ | | ____ | | ___ | | ___ | | \ / | | ___ |')
print(' | | | | | | | | | | | | | | |_| | | | | | | | | | |\ \ / /| | | | | |')
print(' | | | | | | | | | | | | | | | | | | | | | | | | \ \ / / | | | | | |')
print(' | |___| | | |___| | | | | | | | ___ | |___| | | | | | | | \ \/ / | | | | | |')
print(' | ______| | ___| | | | | | | |_ | | ___| | |___| | | | \ / | | | |___| |')
print(' | | | |\ \ | | | | | | | | | |\ \ | ___ | | | \/ | | | ___ |')
print(' | | | | \ \ | | | | | | | | | | \ \ | | | | | | | | | | | |')
print(' | | | | \ \ | |___| | | |___| | | | \ \ | | | | | | | | | | | |')
print(' |_| |_| \_\ |_______| |_______| |_| \_\ |_| |_| |_| |_| |_| |_|')
print(' ')
print(' _______ _______ _______ _ _ _______ _______ _______ ')
print(' | _____| | _____| | _____| | | | | | ___ | | ___ | | _____|')
print(' | | | | | | | | | | | | | | | | | | | |')
print(' | | | | | | | | | | | | | | | | | | | |')
print(' | |_____ | |___ | | ___ | | | | | |___| | | | | | | |_____ ')
print(' |_____ | | ___| | | |_ | | | | | | ___| | | | | |_____ |')
print(' | | | | | | | | | | | | | |\ \ | | | | | | ')
print(' | | | | | | | | | | | | | | \ \ | | | | | |')
print(' _____| | | |_____ | |___| | | |___| | | | \ \ | |___| | _____| |')
print(' |_______| |_______| |_______| |_______| |_| \_\ |_______| |_______| \033[m')
print(' ')
valor = float(input('Digite o valor inicial do veículo... '))
valor = valor * 0.14 # Aplicando preço inicial
vin = valor
print(' ')
seg = 0.0
segm = [[' '] * 11, [0] * 11, [' '] * 11] # Matriz para armazenar dados a serem mostrados ao usuario
print('O veículo possui freio ABS ? ')
freio = int(input('(1) Sim (2) Não '))
Erro = False
if freio is not 2 and freio is not 1:
Erro = True
while Erro: # Erro caso opção informada não seja sim ou não
print("Erro, Digite uma opção válida")
freio = int(input('(1) Sim (2) Não '))
if freio is 1 or freio is 2:
fErro = False
if freio is 1:
seg -= 1.0
segm[0][0] = '-1'
segm[1][0] = valor * 0.01
segm[2][0] = '-'
print(' ')
print('O veículo possui alarme ? ')
alarme = int(input('(1) Sim (2) Não '))
if alarme is not 2 and alarme is not 1:
Erro = True
while Erro:
print(' ')
print("Erro, Digite uma opção válida!") # Erro novamente
alarme = int(input('(1) Sim (2) Não '))
if alarme is 1 or alarme is 2:
Erro = False
if alarme is 1:
seg -= 1.0
segm[0][1] = '-1'
segm[1][1] = valor * 0.01
segm[2][1] = '-'
elif alarme is 2:
seg += 2.0
segm[0][1] = '+2'
segm[1][1] = valor * 0.02
segm[2][1] = '+'
print(' ')
print('O veículo possui vidro elétrico ? ')
ve = int(input('(1) Sim (2) Não '))
if ve is not 2 and ve is not 1:
Erro = True
while Erro:
print(' ')
print("Erro, Digite uma opção válida!") # Erro novamente
ve = int(input('(1) Sim (2) Não '))
if ve is 1 or ve is 2:
Erro = False
if ve is 1:
seg -= 0.5
segm[0][2] = '-0,5'
segm[1][2] = valor * 0.005
segm[2][2] = '-'
elif ve is 2:
seg += 1.0
segm[0][2] = '+1'
segm[1][2] = valor * 0.01
segm[2][2] = '+'
print(' ')
print('O veículo possui rastreador ? ')
ras = int(input('(1) Sim (2) Não '))
if ras is not 2 and ras is not 1:
Erro = True
while Erro:
print(' ')
print("Erro, Digite uma opção válida!") # Erro novamente
ras = int(input('(1) Sim (2) Não '))
if ras is 1 or ras is 2:
Erro = False
if ras is 1:
seg -= 3.0
segm[0][3] = '-3'
segm[1][3] = valor * 0.03
segm[2][3] = '-'
print(' ')
print('Qual é a faixa etária do condutor? ')
print('(1) 18 - 24 anos')
print('(2) 25 - 30 anos')
print('(3) 31 - 42 anos')
print('(4) 42 - 60 anos')
idade = int(input('(5) mais de 61 anos '))
if idade is not 1 and idade is not 2 and idade is not 3 and idade is not 4 and idade is not 5:
Erro = True
while Erro:
print(' ')
print('Erro, Digite uma opção válida')
print('(1) 18 - 24 anos')
print('(2) 25 - 30 anos')
print('(3) 31 - 42 anos')
print('(4) 42 - 60 anos')
idade = int(input('(5) mais de 61 anos '))
if idade is 1 or idade is 2 or idade is 3 or idade is 4 or idade is 5:
Erro = False
if idade is 1:
seg += 2.0
segm[0][4] = '+2'
segm[1][4] = valor * 0.02
segm[2][4] = '+'
elif idade is 2:
seg += 1.0
segm[0][4] = '+1'
segm[1][4] = valor * 0.01
segm[2][4] = '+'
elif idade is 4:
seg -= 2.0
segm[0][4] = '-2'
segm[1][4] = valor * 0.02
segm[2100][4] = '-'
elif idade is 5:
seg -= 1.0
segm[0][4] = '-1'
segm[1][4] = valor * 0.01
segm[2][4] = '-'
print(' ')
print('O veículo possui garagem ?')
print('(1) Sim (2)Não')
gar = int(input('(3) Somente noite (4) Somente noite '))
if gar is not 1 and gar is not 2 and gar is not 3 and gar is not 4:
Erro = True
while Erro:
print(' ')
print('Erro, Digite uma opão válida! ')
print('(1) Sim (2) Não')
gar = int(input('(3) Somente noite (4) Somente noite '))
if gar is 1 or gar is 2 or gar is 3 or gar is 4:
Erro = False
if gar is 1:
seg += 1.5
segm[0][5] = '-1,5'
segm[1][5] = valor * 0.015
segm[2][5] = '-'
elif gar is 2:
seg += 3.0
segm[0][5] = '+3'
segm[1][5] = valor * 0.03
segm[2][5] = '+'
elif gar is 3:
seg += 1.0
segm[0][5] = '+1'
segm[1][5] = valor * 0.01
segm[2][5] = '+'
elif gar is 4:
seg += 2.0
segm[0][5] = '+2'
segm[1][5] = valor * 0.02
segm[2][5] = '+'
print(' ')
print('A quanto tempo o condutor tem habilitação? ')
print('(1) 0 a 2 anos')
print('(2) 3 a 5 anos')
print('(3) 6 a 10 anos')
print('(4) 11 a 20 anos')
cart = int(input('(5) mais de 21 anos '))
if cart is not 1 and cart is not 2 and cart is not 3 and cart is not 4 and cart is not 5:
Erro = True
while Erro:
print(' ')
print('Erro, Digite uma opção válida! ')
print('(1) 0 a 2 anos')
print('(2) 3 a 5 anos')
print('(3) 6 a 10 anos')
print('(4) 11 a 20 anos')
cart = int(input('(5) mais de 21 anos '))
if cart is 1 or cart is 2 or cart is 3 or cart is 4 or cart is 5:
Erro = False
if cart is 1:
seg += 3.0
segm[0][6] = '+3'
segm[1][6] = valor * 0.03
segm[2][6] = '+'
if cart is 2:
seg += 1.0
segm[0][6] = '+1'
segm[1][6] = valor * 0.01
segm[2][6] = '+'
if cart is 4:
seg -= 1.0
segm[0][6] = '-1'
segm[1][6] = valor * 0.01
segm[2][6] = '-'
if cart is 5:
seg -= 2.0
segm[0][6] = '-2'
segm[1][6] = valor * 0.02
segm[2][6] = '-'
print(' ')
print(' ')
print('Qual e o tempo de seguro do veículo ?')
print('(1) 0 a 1 ano')
print('(2) 2 a 4 anos')
print('(3) 5 a 8 anos')
print('(4) 9 a 16 anos')
segt=int(input('(5) mais de 17 anos '))
if segt is not 1 and segt is not 2 and segt is not 3 and segt is not 4 and segt is not 5:
Erro=True
while Erro:
print(' ')
print('Erro, Digite uma opção válida!')
print('(1) 0 a 1 ano')
print('(2) 2 a 4 anos')
print('(3) 5 a 8 anos')
print('(4) 9 a 16 anos')
segt = int(input('(5) mais de 17 anos '))
if segt is 1 or segt is 2 or segt is 3 or segt is 4 or segt is 5:
Erro=False
if segt is 2:
seg-=0.5
segm[0][7]='-0,5'
segm[1][7]=valor*0.005
segm[2][7]='-'
if segt is 3:
seg -= 0.5
segm[0][7] = '-0,8'
segm[1][7] = valor * 0.008
segm[2][7] = '-'
if segt is 4:
seg -= 1
segm[0][7] = '-1'
segm[1][7] = valor * 0.01
segm[2][7] = '-'
if segt is 5:
seg -= 2
segm[0][7] = '-2'
segm[1][7] = valor * 0.02
segm[2][7] = '-'
print(' ')
print('Quantos acidentes o veículo já teve ?')
print('(1) 0 a 1')
print('(2) 2 a 4')
print('(3) 5 a 10')
print('(4) 11 a 15 ')
acdt=int(input('(5) 16 a 25 '))
if acdt is not 1 and acdt is not 2 and acdt is not 3 and acdt is not 4 and acdt is not 5:
print(' ')
print('Erro, Digite uma opção válida!')
print('(1) 0 a 1')
print('(2) 2 a 4')
print('(3) 5 a 10')
print('(4) 11 a 15 ')
acdt = int(input('(5) 16 a 25 '))
if acdt is 1 or acdt is 2 or acdt is 3 or acdt is 4 or acdt is 5:
Erro=False
if acdt is 2:
seg+=2.0
segm[0][8]='+2'
segm[1][8]=valor*0.02
segm[2][8]='+'
elif acdt is 3:
seg += 6.0
segm[0][8] = '+6'
segm[1][8] = valor * 0.06
segm[2][8] = '+'
elif acdt is 4:
seg += 10.0
segm[0][8] = '+10'
segm[1][8] = valor * 0.1
segm[2][8] = '+'
elif acdt is 5:
seg += 20.0
segm[0][8] = '+20'
segm[1][8] = valor * 0.2
segm[2][8] = '+'
print(' ')
print('O veículo possui quantos condutores ?')
print('(1) 0')
print('(2) 1')
print('(3) 2 a 4')
print('(4) 5 a 9')
cond=int(input('(5) mais de 10 '))
if cond is not 1 and cond is not 2 and cond is not 3 and cond is not 4 and cond is not 5:
Erro=True
while Erro:
print(' ')
print('Erro, Digite uma opção válida!')
print('(1) 0')
print('(2) 1')
print('(3) 2 a 4')
print('(4) 5 a 9')
cond = int(input('(5) mais de 10 '))
if cond is 1 or cond is 2 or cond is 3 or cond is 4 or cond is 5:
Erro=False
if cond is 2:
seg+=1.0
segm[0][9]='+1'
segm[1][9]=valor*0.01
segm[2][9]='+'
elif cond is 3:
seg+=3.0
segm[0][9] = '+3'
segm[1][9] = valor * 0.03
segm[2][9] = '+'
elif cond is 4:
segm[0][9] = '+6'
segm[1][9] = valor * 0.06
segm[2][9] = '+'
elif cond is 5:
segm[0][9] = '+10'
segm[1][9] = valor * 0.1
segm[2][9] = '+'
print(' ')
print('Qual é o estado civil do cliente?')
escivil=int(input('(1) Casado (2)Solteiro '))
if escivil is not 1 and escivil is not 2:
Erro=True
while Erro:
print(' ')
print('Erro, Digite uma opção válida! ')
escivil = int(input('(1) Casado (2)Solteiro '))
if escivil is 1 or escivil is 2:
Erro=False
if escivil is 1:
seg-=0.5
segm[0][10]='-0,5'
segm[1][10]=valor*0.005
segm[2][10]='-'
elif escivil is 2:
segm[0][10] = '+1'
segm[1][10] = valor * 0.01
segm[2][10] = '+'
valor = valor + valor * seg / 100.0
print(' ')
print('\33[1;32m<=================================================================>')
print(' ')
print(' O preço final do seguro será R${:.2f}'.format(valor))
print(' ')
print('<=================================================================>\033[m')
print(' ')
print('Foram aplicados os seguintes descontos no seguro: ')
print(' ')
print('Preço inicial do seguro equivalente a 14% do preço do veículo: {:.2f}'.format(vin))
if segm[0][0] is not ' ':
print('Freio ABS: {}% ({}R${:.2f})'.format(segm[0][0], segm[2][0], segm[1][0]))
print('Alarme: {}% ({}R${:.2f})'.format(segm[0][1], segm[2][1], segm[1][1]))
print('Vidro elétrico: {}% ({}R${:.2f})'.format(segm[0][2], segm[2][2], segm[1][2]))
if segm[0][3] is not ' ':
print('Rastreador: {}% ({}R${:.2f})'.format(segm[0][3], segm[2][3], segm[1][3]))
if segm[0][4] is not ' ':
print('Idade do condutor: {}% ({}R${:.2f})'.format(segm[0][4], segm[2][4], segm[1][4]))
print('Garagem: {}% ({}R${:.2f})'.format(segm[0][5], segm[2][5], segm[1][5]))
if segm[0][6] is not ' ':
print('Tempo de habilitação do condutor: {}% ({}R${:.2f})'.format(segm[0][6], segm[2][6], segm[1][6]))
if segm[0][7] is not ' ':
print('Tempo de seguro: {}% ({}R${:.2f})'.format(segm[0][7], segm[2][7], segm[1][7]))
if segm[0][8] is not ' ':
print('Quantidade de acidentes: {}% ({}R${:.2f})'.format(segm[0][8], segm[2][8], segm[1][8]))
if segm[0][9] is not ' ':
print('Quantidade de condutores: {}% ({}R${:.2f})'.format(segm[0][9], segm[2][9], segm[1][9]))
print('Estado civil do cliente: {}% ({}R${:.2f})'.format(segm[0][10], segm[2][10], segm[1][10]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment