Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. from random import randint
  2. print("Проверка случайности функции \"randint\" из модуля \"random\" ")
  3. def RD():
  4.     for rand in range(10000):
  5.         print(randint(1, 100))
  6.  
  7. file = open('rannd.txt', 'w')
  8. file = open('rannd.txt', 'a')
  9. file = open('rannd.txt', 'r')
  10. file.write(str(RD()))
  11.  
  12. file1 = input("Открыть файл с 10000 случайных чисел в диапазоне от 1 до 100? Yes/No:")
  13.  
  14. file1 = open('rannd.txt', 'r')
  15.  
  16. if file1 == "No":
  17.     print("Хорошо")
  18. elif file1 == "Yes":
  19.     strings = file.readlines(10000)
  20.     print( strings )
  21.     file.readlines()
  22.     print( strings )
  23.  
  24. import os
  25.  
  26. path = os.path.join(os.path.abspath(os.path.dirname(_file_)), 'rannd.txt')
  27. os.remove(path)
  28.  
  29. input("\n\nНажмите Enter. чтобы выйти.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement