I want to generate random numbers with a few chosen numbers. for example, if the chosen number has 2 place value, then it should print two chosen number + four value but the code throwing error message after running :(
def y(x):
two_value = random.randint(700000,999999)
three_value = random.randint(70000, 99999)
four_value = random.randint(7000, 9999)
place_value = len(x)
if place_value == 2:
print(f'Your random 2 digit favorite number :{x},{two_value}')
elif place_value == 3:
print(f'Your random 3 digit favorite number :{x},{three_value}')
elif place_value == 4:
print(f'Your random 4 digit favorite number :{x},{four_value}')
else:
print("error")
print(y(15))
"C:\Users\WIN Ultimate\PycharmProjects\new\venv\Scripts\python.exe" "C:/Users/WIN Ultimate/PycharmProjects/new/Numbergenerator.py"
Traceback (most recent call last):
File "C:/Users/WIN Ultimate/PycharmProjects/new/Numbergenerator.py", line 35, in <module>
print(y(15))
File "C:/Users/WIN Ultimate/PycharmProjects/new/Numbergenerator.py", line 26, in y
place_value = len(y)
TypeError: object of type 'function' has no len()