Комментарии:
import random
import string
list1 = []
list2 = []
list3 = []
password = ''
user1 = int(input("how many digits do you want for password? "))
for digits in range(user1):
digits = list1.append(random.choice(string.digits))
user2 = int(input("how many symbols do you want for password? "))
for symbols in range(user2):
symbols = list2.append(random.choice(string.punctuation))
user3 = int(input("how many chars do you want for password? "))
for chars in range(user3):
chars = list3.append(random.choice(string.ascii_letters))
key = list1 + list2 + list3
random.shuffle(key)
for i in key:
password += i
print(password)
Can't we use join() instead of for loop
Ответитьi did it with the use of append and its works . its easy to understand take less time and take less line too.
import random
password = []
shufflee = []
strr = ""
letter = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
numbers = [1,2,3,4,5,6,7,8,9,0]
symbol = ['~','!','@','#','$','%','^','&','*','(',')','_',']']
letter_choose = int(input("how many letter would you want in your password: "))
for i in range(letter_choose):
b = random.choice(letter)
password.append(b)
numbers_choose = int(input("how many numbers would you want in your password: "))
for i in range(numbers_choose):
a = random.choice(numbers)
password.append(a)
symbol_choose = int(input('how many numbers would you want in your password: '))
for i in range(symbol_choose):
c = random.choice(symbol)
password.append(c)
print(password)
random.shuffle(password)
for i in range(len(password)):
strr = strr + str(password[i])
print(strr)
import random
print("Welcome to the Password Generator!")
letters=int(input("How many letters you want in your password?\n"))
symbols=int(input("How many symbols you want in your password?\n"))
numbers=int(input("How many numbers you want in your password?\n"))
if((letters<0) or (symbols<0) or (numbers<0)):
print("Invalid input.")
else:
list = []
for i in range(0,letters):
random_letters = random.choice(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P','Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
list.append(random_letters)
for i in range(0,symbols):
random_symbols = random.choice(['!', '#', '$', '%', '&', '(', ')', '*', '+'])
list.append(random_symbols)
for i in range(0,numbers):
random_numbers = random.choice(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
list.append(random_numbers)
print(f"List before shuffling : {list}")
random.shuffle(list)
print(f"List after shuffling : {list}")
if(len(list)==0):
print("No password generated.")
else:
password = ''
for i in list:
password = password + i
print(f"Your password is : {password}")
Tnx Jenny mam interesting project you teach 😘👏👏
Ответитьimport random
print('Welcome to password generator')
num = int(input('How many numbers you want ? '))
spl = int(input('How many special character you want ? '))
char = int(input('How many alphabet you want ? '))
Num = []
for i in range(0,10) :
Num.append(str(i))
Spl = list("""~!@#$%^&*()_+{}|:"<>?-=\;,./'""")
Char = list('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
password = []
for i in range(0,num) :
password.append(random.choice(Num))
for i in range(0,spl) :
password.append(random.choice(Spl))
for i in range(0,char) :
password.append(random.choice(Char))
random.shuffle(password)
p = password
password = ''
for i in p :
password += i
print(password)
Tq so much mam
ОтветитьInstead of typing all alphabets u can use this :
import random
letter=[]
for i in range(ord('a'), ord('z')+1):
letter.append(chr(i))
for i in range(ord('A'), ord('Z')+1):
letter.append(chr(i))
print(letter)
number=[]
for i in range(10):
number.append(i)
number[i]=str(number[i])
print(number)
symbol=['!','@','#','$','%','&','*','(',')','+']
print("Welcome to the passworrd generator.")
letters=int(input("How many letters would you like in your password? "))
numbers=int(input("How many numbers would you like? "))
symbols=int(input("How many symbols would you like? "))
password_list=[]
for i in range(1,letters+1):
a=random.choice(letter)
password_list+=a
for i in range(1,numbers+1):
b=random.choice(number)
password_list+=b
for i in range(1,symbols+1):
c=random.choice(symbol)
password_list+=c
random.shuffle(password_list)
password=""
for i in password_list:
password+=i
print(password)
cutie patootiee
Ответитьimport random
import string
print ('Welcome to password generator')
n = int(input('How many numbers do you want ? '))
l = int(input("How many letters do you want ? "))
c = int(input("How many capital letters do you want ? "))
s = int(input('How many symbols do you want to have in your password ? '))
letters = random.choices(string.ascii_lowercase, k = l)
cap = random.choices(string.ascii_uppercase, k = c)
r = random.choices(range(0, 10), k = n)
sym = random.choices(string.punctuation, k = s)
p = (letters + r + sym + cap)
random.shuffle(p)
for item in p:
print (item, end = '')
import random
print("welcome to password generator!")
a=int(input("how many numbers you want in your password:"))
list1=[]
for a in range(0,a):
b=random.randint(0,9)
list1.append(b)
c=int(input("how many symbols would to like to have:"))
list2=["@","#","$","%","^","&","*","[","]","(",")","-","_","<",">","/","+","="]
d=(random.choices(list2,k=c))
e=int(input("how many lower case letters you want:"))
list3=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
f=random.choices(list3,k=e)
g=int(input("how many upper case letters you want to have:"))
list4=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
h=random.choices(list4,k=g)
str1=''.join(map(str,list1))
str2=''.join(map(str,d))
str3=''.join(map(str,f))
str4=''.join(map(str,h))
str=str1+str2+str3+str4
print(str)
Sister pls I want more projects on python plsplsssss
ОтветитьThank u mam for ur wonderful presentation.
ОтветитьAnyways passwords print only one letter ,😢😢😢.why?
ОтветитьMam please start Java programming.....
ОтветитьOld Jenny is back
ОтветитьMam please complete c++ series🙏🙏🙏🙏
ОтветитьMam I'm come from Instagram 😮
ОтветитьMam whatever you teach , do you have pdf of this notes . So we can easily read them and watch you, without making self notes
ОтветитьMam when will you start Java mam
ОтветитьI love your teaching and your eyes I will come to India and I married with you love for Afghanistan ♥️🇦🇫
ОтветитьCuteness overloaded💓
ОтветитьMam I love u so much ❤️
ОтветитьDi, I am clear 12th class this year. (I am waiting result).
I want to study AI and machine Learning.
What, I am doing? Next
Means that what course and program I chose.
To become a AI and machine learning expert.
I hadMissed your lecture that bad😀
ОтветитьThank You Excellent Mam
ОтветитьMam,Thankyou very much for coming back 🎉🎉🎉
Ответитьimport random
import string
password=''
print('welcome to password generator')
words=[random.choice(string.ascii_letters) for i in range(int(input('enter how many letters')))]
numbers=[random.choice(string.digits) for i in range(int(input('enter how many numbers')))]
symbol=[random.choice(string.punctuation) for i in range(int(input('enter how many symbols')))]
key=words+numbers+symbol
random.shuffle(key)
for i in key:
password=password+i
print(password)
Mam I've made GUI base one but that doesn't ask for such conditions 😂
I loved this one and can't wait to try this soon❤❤
Mam, please continue c++ series mam.. We are waiting
ОтветитьMam please respond mam 🙏🙏🙏🙏🙏🙏🙏🙏😭😭😭😭😭 when will you continue C++ series mam.. completed C and eagerly waiting for C++ please continue mam upload full course 🥺🥺🙏🙏🥺🙏🙏🥺🙏
ОтветитьThank you so much mam please continue python mam
ОтветитьPlease provide the code files and the links in the description as soon as possible for free 🙏 thank you so much.
ОтветитьMam why don't you try to act in movies... ❤
ОтветитьDi please continue your dbms series..
Ответить