So as per your requirement you can do as per below code. you just need to keep checking until user enters correct otp. if user enter wrong otp show ACCESS DENIED and ask again to enter otp
import random
import string
def rand_pass(size):
generate_pass=''.join([random.choice(string.ascii_uppercase+string.ascii_lowercase+string.digits)for n in range(size)])
return generate_pass
generated_otp = rand_pass(10)
print('new OTP :'+generated_otp)
while True:
OTP = input('enter your OTP here:')
if OTP == generated_otp:
print('Correct OTP')
break
else:
print('ACCESS DENIED.')
continue
@GhostwhiteActualCompilers Please let me know if this is useful.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…