Advertisement
Guest User

Untitled

a guest
May 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import random
  2.  
  3. iloscliczb = int(input("Ilość liczb do wylosowania: "))
  4. maxliczba = int(input("Maksymalna liczba wylosowana to: "))
  5.  
  6. liczby = []
  7.  
  8. x = 0
  9. while x < iloscliczb:
  10. liczba = random.randint(1, maxliczba)
  11. if liczby.count(liczba) == 0:
  12. liczby.append(liczba)
  13. x += 1
  14.  
  15. print ("Wylosowane liczby: ", sorted(liczby))
  16. print ("Suma wylosowanych liczb wynosi: ", sum(liczby), '\n')
  17. input("Naciśnij ENTER aby zakończyć program")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement