Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | None | 0 0
  1. n = int(input('Número de entrevistas: '))
  2.  
  3. genreList = []
  4. eyeList = []
  5. ageList = []
  6. womanList = []
  7.  
  8. currentInterview = 1
  9.  
  10. if n > 0:
  11.     for k in range(n):
  12.         print('=' * 32)
  13.         print('        ENTREVISTA {}/{}'.format(currentInterview, n))
  14.         print('=' * 32)
  15.        
  16.         genre = str(input('Qual é o sexo [M, F]? '))
  17.         eye = int(input('Qual é a cor dos olhos [1 - Azul, 2 - Castanho, 3 - Verde]? '))
  18.         age = int(input('Qual é a idade? '))
  19.  
  20.         genreList.append(genre.upper())
  21.         eyeList.append(eye)
  22.         ageList.append(age)
  23.  
  24.         if genre.upper() == 'F' and age >= 30:
  25.             womanList.append(genre)
  26.  
  27.         currentInterview += 1
  28. else:
  29.     print('O número de entrevistas deve ser maior que 0.')
  30.  
  31. def getRankingAge():
  32.     CURRENT_BEST = 0
  33.  
  34.     for key in ageList:
  35.         if key > CURRENT_BEST:
  36.             CURRENT_BEST = key
  37.  
  38.     return CURRENT_BEST
  39.  
  40. def getEyesByColor():
  41.     BLUE = 0
  42.     BROWN = 0
  43.     GREEN = 0
  44.  
  45.     for key in eyeList:
  46.         if key == 1:
  47.             BLUE += 1
  48.         elif key == 2:
  49.             BROWN += 1
  50.         elif key == 3:
  51.             GREEN += 1
  52.  
  53.     return BLUE, BROWN, GREEN
  54.  
  55. def getWomenOver30():
  56.     TOTAL = 0
  57.  
  58.     for key in womanList:
  59.         TOTAL += 1
  60.  
  61.     return TOTAL
  62.  
  63. def getTotalMen():
  64.     TOTAL = 0
  65.  
  66.     for key in genreList:
  67.         if key == 'M':
  68.             TOTAL += 1
  69.  
  70.     return TOTAL
  71.  
  72. print('=' * 32)
  73. print('        RESULTADO')
  74. print('=' * 32)
  75.  
  76. print('Maior idade: {}'.format(getRankingAge()))
  77. print('Azul: {}'.format(getEyesByColor()[0]))
  78. print('Castanho: {}'.format(getEyesByColor()[1]))
  79. print('Verde: {}'.format(getEyesByColor()[2]))
  80. print('Mulheres acima de 30 anos: {}'.format(getWomenOver30()))
  81. print('Homens que participaram: {}'.format(getTotalMen()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement