Advertisement
nolovedeepmath

Untitled

Feb 19th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. # exercício 1
  2. '''
  3. lista = []
  4.  
  5. for i in range(1, 11):
  6.    n = str(input('Digite o {}º nome: '.format(i)))
  7.    lista.append(n)
  8.  
  9. for c in range(0, 10):
  10.    print('{} foi o {}º nome'.format(lista[c], c + 1))
  11.  
  12. # exercício 2
  13. lista1 = []
  14.  
  15. for i in range(0, 10):
  16.    valor = int(input('Digite o {}º valor: '.format(i + 1)))
  17.    lista1.append(valor)
  18.    media = sum(lista1) // len(lista1)
  19.  
  20. print('A média é de: ', media)
  21.  
  22. for c in range(len(lista1)):
  23.    if lista1[c] > media:
  24.        print('O(s) valor(s) na lista acima da média são: ', lista1[c])
  25.  
  26. # exercício 3
  27.  
  28. lista2 = []
  29.  
  30. for i in range(0,4):
  31.    nome = str(input('Digite um nome: '))
  32.    lista2.append(nome)
  33.  
  34. procura = str(input('Pesquise um nome: '))
  35.  
  36. if procura in lista2:
  37.    print('O nome {} está na lista'.format(procura))
  38.  
  39. else:
  40.    print('O nome {} não está na lista'.format(procura))
  41.  
  42. # exercício 4
  43. '''
  44. from random import randint
  45. '''
  46. posi = int(input('Digite um número: '))
  47. vetor = []
  48.  
  49. def vet():
  50.    for i in range(0, posi):
  51.        vetor.append(randint(0,100))
  52.    return vetor
  53. print('Os valores no vetor são: ', vet())
  54.  
  55. # exercício 5
  56. c = 0
  57. while c < 15:
  58.    print(c ** 2)
  59.    
  60.    c += 1
  61.  
  62. # exercicio 6
  63. '''
  64. vet = []
  65.  
  66. for i in range(0,19):
  67.     vet.append(randint(0,999))
  68.  
  69. print(vet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement