Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import re
  2. import random
  3.  
  4. def inp(f,msg1,msg2):
  5.   a=input(msg1)
  6.   if f(a):
  7.      return a
  8.   else:
  9.      print(msg2)
  10.      return inp(f,msg1,msg2)
  11.  
  12. line=lambda:print("~~~~~~~~~~~~~~~~~~~~")
  13. number=r"(0|([1-9]+[0-9]*))"
  14. isnum=lambda x:re.search(number,x)
  15.  
  16. def gen_list():
  17.   line()
  18.   num=inp(isnum,"Please, enter number: ","Please, try again:<")
  19.   print([random.randint(0,100) for i in range(0,int(num))])
  20.   line()
  21.  
  22. def final():
  23.   gen_list()
  24.   a=input("Exit?[0 - no,1 - yes]: ")
  25.   if a=="1":
  26.     print("Thank you for using! =3")
  27.   else:
  28.     final()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement