Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make password creator using python

from numpy import array
import random
import string

print("This is a password creator")

print("type 1 for only number password or type 2 for alphabet password or type 0 for mixed password")
y = int(input("enter"))
print("type how many digits of password you want")
x = int(input("enter"))
if y==1:
    print("ok you choosed password in number")
    for i in range(0,x):
        k = random.randint(0,9)
        print(k,end="")
        
elif y == 2:
    print("ok you choosed alphabet password")
    n = 1
    for i in range(x):
        randomLowerLetter = chr(random.randint(ord('a'), ord('z')))
        randomUpperLetter = chr(random.randint(ord('A'), ord('Z')))
       
        
        if n%2==0:
            print(randomLowerLetter,end="")
        elif n%2!=0:
            print(randomUpperLetter,end="")
        n= n + 1

elif y == 0:
    print("ok you choosed mixed password of alphabet and numbers")
    n=1
    letter = 0
    for i in range(x):
        
        randomLowerLetter = chr(random.randint(ord('a'), ord('z')))
        randomUpperLetter = chr(random.randint(ord('A'), ord('Z')))
        k = random.randint(0,9)
        if n%2==0:
            print(randomLowerLetter,end="")
            if letter +1 != x:
                print(k,end="")
                letter+=2
            else:
                letter+=1
                
        elif n%2!=0:
            print(randomUpperLetter,end="")
            letter+=1
        n=n+k
    
        if letter >= x:
            
            break
        
        

else:
    print("read carefully")
print()
print("thanks")
 
PREVIOUS NEXT
Tagged: #password #creator #python
ADD COMMENT
Topic
Name
6+4 =