import string
import random
def generate_id(length=4):
password = string.digits
user_id = ''
i = 0
while i < length:
user_id += random.choice(password)
i += 1
return user_id
print(generate_id())
import random
def generate_id(length=4):
password = string.digits
user_id = ''
i = 0
while i < length:
user_id += random.choice(password)
i += 1
return user_id
print(generate_id())