Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- # Cรกlculo de Seguro
- # Amanda Luna [116210896] / UFCG
- def seguro(valor,lista) :
- lista2 = []
- pontos = 0
- if int(lista[0]) <= 21 :
- pontos += 20
- elif int(lista[0]) >= 22 and idade <= 30 :
- pontos += 15
- elif int(lista[0]) >= 31 and idade <= 40 :
- pontos += 12
- elif int(lista[0]) >= 41 and idade <= 60 :
- pontos += 10
- else :
- pontos += 20
- if lista[1] == "False" :
- pontos += 20
- else :
- pontos += 10
- if lista[2] == "False" :
- pontos += 10
- else :
- pontos += 20
- if lista[3] == "False" :
- pontos += 10
- else :
- pontos += 20
- if lista[4] == "False" :
- pontos += 10
- else :
- pontos += 20
- if lista[5] == "False" :
- pontos += 20
- else :
- pontos += 10
- if lista[6] == 'Trabalho' :
- pontos += 10
- elif lista[6] == 'Lazer' :
- pontos += 20
- else :
- pontos += 20
- lista2.append(pontos)
- if pontos <= 80 :
- risco = "Risco Baixo"
- seguro = valor*0.1
- lista2.append(risco)
- lista2.append(seguro)
- elif pontos > 80 and pontos <= 100 :
- risco = "Risco Medio"
- seguro = valor*0.2
- lista2.append(risco)
- lista2.append(seguro)
- else :
- risco = "Risco Alto"
- seguro = valor*0.3
- lista2.append(risco)
- lista2.append(seguro)
- print lista2
- assert seguro(2000.0, [21, True, True, True, True, True, 'Misto']) == [120, "Risco Alto", 600.0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement