Python Project 2 | Password Generator in Python | Python for Beginners #lec49

Python Project 2 | Password Generator in Python | Python for Beginners #lec49

Jenny's Lectures CS IT

1 год назад

69,508 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ahmad Parsi
Ahmad Parsi - 27.09.2023 17:55

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)

Ответить
Sparrow yt
Sparrow yt - 14.09.2023 14:54

Can't we use join() instead of for loop

Ответить
Rahul Singh
Rahul Singh - 13.09.2023 09:09

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)

Ответить
Raghav Sanoria
Raghav Sanoria - 21.08.2023 18:33

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}")

Ответить
Pravin Singh
Pravin Singh - 11.08.2023 17:46

Tnx Jenny mam interesting project you teach 😘👏👏

Ответить
Sudhakar Raja
Sudhakar Raja - 05.07.2023 18:28

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)

Ответить
Nireesha 549
Nireesha 549 - 01.07.2023 08:45

Tq so much mam

Ответить
Ritik Patel
Ritik Patel - 15.06.2023 17:29

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)

Ответить
Lavish Kumar
Lavish Kumar - 14.06.2023 18:54

cutie patootiee

Ответить
Ritwik 2002 Sharma
Ritwik 2002 Sharma - 12.05.2023 09:18

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 = '')

Ответить
Deekshitha Subrahmanyam
Deekshitha Subrahmanyam - 08.05.2023 20:20

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)

Ответить
Praneetha Malakapalli
Praneetha Malakapalli - 30.04.2023 10:08

Sister pls I want more projects on python plsplsssss

Ответить
sugan
sugan - 27.04.2023 10:28

Thank u mam for ur wonderful presentation.

Ответить
KT'S Computer and Security Systems
KT'S Computer and Security Systems - 25.04.2023 16:17

Anyways passwords print only one letter ,😢😢😢.why?

Ответить
Vanteddu Alekhya
Vanteddu Alekhya - 24.04.2023 15:50

Mam please start Java programming.....

Ответить
Yasotha Karthikeyan
Yasotha Karthikeyan - 24.04.2023 13:34

Old Jenny is back

Ответить
Ashdeep kashyap
Ashdeep kashyap - 24.04.2023 11:17

Mam please complete c++ series🙏🙏🙏🙏

Ответить
மாட்டு⚡DEVA 😈
மாட்டு⚡DEVA 😈 - 24.04.2023 10:18

Mam I'm come from Instagram 😮

Ответить
ABHISHEK BHATI
ABHISHEK BHATI - 24.04.2023 10:09

Mam whatever you teach , do you have pdf of this notes . So we can easily read them and watch you, without making self notes

Ответить
KASIMKOTA BINDU SAI SREE
KASIMKOTA BINDU SAI SREE - 24.04.2023 07:37

Mam when will you start Java mam

Ответить
ENA
ENA - 23.04.2023 21:37

I love your teaching and your eyes I will come to India and I married with you love for Afghanistan ♥️🇦🇫

Ответить
BharathGamingYt
BharathGamingYt - 23.04.2023 21:27

Cuteness overloaded💓

Ответить
BharathGamingYt
BharathGamingYt - 23.04.2023 21:27

Mam I love u so much ❤️

Ответить
Question Mark
Question Mark - 23.04.2023 19:34

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.

Ответить
Manfred Masiko
Manfred Masiko - 23.04.2023 18:10

I hadMissed your lecture that bad😀

Ответить
Information Channel
Information Channel - 23.04.2023 18:06

Thank You Excellent Mam

Ответить
ravada rajasehkar
ravada rajasehkar - 23.04.2023 18:04

Mam,Thankyou very much for coming back 🎉🎉🎉

Ответить
seenu Madhavan
seenu Madhavan - 23.04.2023 18:02

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)

Ответить
Swarnim Dubey
Swarnim Dubey - 23.04.2023 18:02

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❤❤

Ответить
s
s - 23.04.2023 17:19

Mam, please continue c++ series mam.. We are waiting

Ответить
Paavanee P
Paavanee P - 23.04.2023 17:15

Mam please respond mam 🙏🙏🙏🙏🙏🙏🙏🙏😭😭😭😭😭 when will you continue C++ series mam.. completed C and eagerly waiting for C++ please continue mam upload full course 🥺🥺🙏🙏🥺🙏🙏🥺🙏

Ответить
Rongala Manindra
Rongala Manindra - 23.04.2023 17:13

Thank you so much mam please continue python mam

Ответить
Pandipati Pavan
Pandipati Pavan - 23.04.2023 17:13

Please provide the code files and the links in the description as soon as possible for free 🙏 thank you so much.

Ответить
TELIKA PRANAY
TELIKA PRANAY - 23.04.2023 17:08

Mam why don't you try to act in movies... ❤

Ответить
Akshita Jain
Akshita Jain - 23.04.2023 17:08

Di please continue your dbms series..

Ответить