DEV Community

عاشق الابداع
عاشق الابداع

Posted on

guess a number from 4 digit

import random
digit = (input("Enter a 4-digit Pin Code: \n"))
my_random_d = random.randint(1000,9999)
if len(digit) ==4:
if my_random_d==digit:
print("Pin Code Matched")
else:
print(f"Failure! Pin Code did not match.\n The Computer generated this code: {my_random_d}")
else:
print("Please Enter 4 digits")

Top comments (0)