Advertisement
ADevingFre

common_func

Sep 25th, 2022
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. from re import compile
  2.  
  3. integer_pat = compile("[-+]?\d+")
  4.  
  5. is_int = integer_pat.fullmatch
  6.  
  7.  
  8. def int_input(prompt, error):
  9.     while not is_int(inp := input(prompt)):
  10.         print(error)
  11.     return inp
  12.  
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement