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")
import random
strong_keys = ["@","#","$","£","π","¥","&","3","¢","3","*","?","!","%","/","G","A","B","F","W","F","H","6","9",":","^","=","|","~","∆"]
def password():
try:
n = int(input('your password contain(type in number) : '))
except:
print('Rerun the program and type in number please')
ans = ""
for i in range(n):
rand = random.choice(strong_keys)
if i == 0:
ans = rand
else:
ans += rand
print('
your password: '+ans+'
')
user = input('if you dont like this?
Type "r" else "q" : ')
if user.lower() == 'r':
password()
else:
quit()
password()
from random import randint
def create_random_chars(nbr_of_chars):
return "".join(chr(randint(33,126)) for i in range(nbr_of_chars))
print(create_random_chars(10))
# I1CU>E5q;$