import random
lower ="abcdefghijklmnopqrstuvwxyz"
upper ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numbers ="0123456789"
symbols ="@#$&_-()=%*:/!?+."
string = lower + upper + numbers + symbols
length =int(input("How Many Characters Do You Want Your Password To Be: "))
password ="".join(random.sample(string, length))print("Here Is Your Password:", password)
import random, string
defgenerate_password(length:int=4)->str:# add lower case chars
lower =[random.choice(string.ascii_lowercase)for i inrange(length)]# add digit chars
digit =[random.choice(string.digits)for i inrange(length)]# add upper case chars
upper =[random.choice(string.ascii_uppercase)for i inrange(length)]# add symbols
symbol =[random.choice(["!","@","#","$","%","^","&","*","(",")","_","-","+","=",".",",","?"])for i inrange(length)]# store random generated lists to a variable
original = lower+digit+upper+symbol
# shuffle stored data in place
random.shuffle(original)return''.join(original)
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 inrange(0,x):
k = random.randint(0,9)print(k,end="")elif y ==2:print("ok you choosed alphabet password")
n =1for i inrange(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 +1elif y ==0:print("ok you choosed mixed password of alphabet and numbers")
n=1
letter =0for i inrange(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+=2else:
letter+=1elif n%2!=0:print(randomUpperLetter,end="")
letter+=1
n=n+k
if letter >= x:breakelse:print("read carefully")print()print("thanks")
import random
strong_keys =["@","#","$","£","π","¥","&","3","¢","3","*","?","!","%","/","G","A","B","F","W","F","H","6","9",":","^","=","|","~","∆"]defpassword():try:
n =int(input('your password contain(type in number) : '))except:print('Rerun the program and type in number please')
ans =""for i inrange(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()
import string
import random
## characters to generate password from
alphabets =list(string.ascii_letters)
digits =list(string.digits)
special_characters =list("!@#$%^&*()")
characters =list(string.ascii_letters + string.digits +"!@#$%^&*()")defgenerate_random_password():## length of password from the user
length =int(input("Enter password length: "))## number of character types
alphabets_count =int(input("Enter alphabets count in password: "))
digits_count =int(input("Enter digits count in password: "))
special_characters_count =int(input("Enter special characters count in password: "))
characters_count = alphabets_count + digits_count + special_characters_count
## check the total length with characters sum count## print not valid if the sum is greater than lengthif characters_count > length:print("Characters total count is greater than the password length")return## initializing the password
password =[]## picking random alphabetsfor i inrange(alphabets_count):
password.append(random.choice(alphabets))## picking random digitsfor i inrange(digits_count):
password.append(random.choice(digits))## picking random alphabetsfor i inrange(special_characters_count):
password.append(random.choice(special_characters))## if the total characters count is less than the password length## add random characters to make it equal to the lengthif characters_count < length:
random.shuffle(characters)for i inrange(length - characters_count):
password.append(random.choice(characters))## shuffling the resultant password
random.shuffle(password)## converting the list to string## printing the listprint("".join(password))## invoking the function
generate_random_password()
from random import randint
defcreate_random_chars(nbr_of_chars):return"".join(chr(randint(33,126))for i inrange(nbr_of_chars))print(create_random_chars(10))# I1CU>E5q;$
import string
import random
## characters to generate password from
characters =list(string.ascii_letters + string.digits +"!@#$%^&*()")defgenerate_random_password():## length of password from the user
length =int(input("Enter password length: "))## shuffling the characters
random.shuffle(characters)## picking random characters from the list
password =[]for i inrange(length):
password.append(random.choice(characters))## shuffling the resultant password
random.shuffle(password)## converting the list to string## printing the listprint("".join(password))## invoking the function
generate_random_password()