SHARE
TWEET

Untitled

a guest Jun 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. n1=0
  3. n2=0
  4. n1=int(input('Insira um numero para inicio'))
  5. n2=int(input('Insira um numero para limite'))
  6. i=1
  7. lista=[]
  8. for i in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]:
  9.     lista.append(random.randint(n1,n2))
  10. i=1
  11. count=0
  12. print(lista[i-1])
  13. lista.sort()
  14. while i<=15:
  15.     while lista[i]==lista[i-1]: ''' aqui da o erro: index out of range'''
  16.         lista.pop(i)
  17.         lista.insert(i,random.randint(n1,n2))
  18.     i+=1
  19. print(lista)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top