Advertisement
Guest User

ifcode feliz

a guest
Oct 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.65 KB | None | 0 0
  1. ### 2949 - A sociedade do anel - Accepted ###
  2. anao, elfo, humano, mago, hobbit = 0, 0, 0, 0, 0
  3. pessoa = ''
  4. vezes = int(input())
  5. for x in range(vezes):
  6.     pessoa = input()
  7.     if pessoa.endswith('A'):
  8.         anao += 1
  9.     elif pessoa.endswith('E'):
  10.         elfo += 1
  11.     elif pessoa.endswith('H'):
  12.         humano += 1
  13.     elif pessoa.endswith('M'):
  14.         mago += 1
  15.     else:
  16.         hobbit += 1
  17.  
  18. print('{} Hobbit(s)\n{} Humano(s)\n{} Elfo(s)\n{} Anao(s)\n{} Mago(s)'.format(hobbit,humano,elfo,anao,mago))
  19.  
  20. ### 2950 - as duas torres - accepted ###
  21. x = input().split(' ')
  22. distancia = int(x[0])
  23. diam1, diam2 = int(x[1]), int(x[2])
  24. print('{:.2f}'.format(distancia/(diam1+diam2)))
  25.  
  26. ### 2960 - era uma vez - runtime error ###
  27. nomelinguagem = []
  28. total = []
  29. total2 = []
  30.  
  31. vogais = list('aeiou')
  32. vogac = 0
  33. consc = 0
  34.  
  35. vezes = int(input())
  36. for i in range(vezes):
  37.     vezesvezes = int(input())
  38.     iniciaislivros = []
  39.     for i in range(vezesvezes):
  40.         livro = input()
  41.         iniciaislivros.append((livro[:1]).lower())
  42.     iniciaislivro = ''.join(iniciaislivros)
  43.     total.append(''.join(iniciaislivros))
  44.     nomelinguagem.append((iniciaislivro[:1]).upper())
  45.  
  46. for i in total:
  47.     for x in i:
  48.         if x not in total2:
  49.             total2.append(x)
  50.  
  51. for i in total2:
  52.     if i in vogais:
  53.         vogac += 1
  54.     else:
  55.         consc += 1
  56.  
  57. nomelinguagem = ''.join(nomelinguagem)
  58.  
  59. tempo = (len(total2)+vogac)/consc
  60.  
  61. print('Nome da Linguagem: {}'.format(nomelinguagem.upper()))
  62. print('Lista de Palavras:')
  63. for i in total:
  64.     print(i)
  65. print('Número de Vogais: {}'.format(vogac))
  66. print('Número de Consoantes: {}'.format(consc))
  67. print('Número Total de Letras: {}'.format(len(total2)))
  68. print('Tempo para aprender: {:.1f} horas'.format(tempo))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement