Write a python function to generate 4 digit OTP


Topic: Write a python function to generate 4 digit OTP

Solution

import math, random 
def generateOTP() : 
    digits = "0123456789"
    OTP = "" 
    for i in range(4) : 
        OTP += digits[math.floor(random.random() * 10)] 
    return OTP



List all Python Programs