I Created a Password Generator using Python

I Created a Password Generator using Python

CodeWithHarry

4 года назад

96,274 Просмотров

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


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

@AliAhmed-he5fk
@AliAhmed-he5fk - 14.11.2023 18:54

Thankss

Ответить
@pragatiagrawal7212
@pragatiagrawal7212 - 14.11.2023 10:43

In my pc ..the problem only runs for one time ..How to handle that without using while true

Ответить
@srkafridi112
@srkafridi112 - 06.10.2023 23:41

Fantastic🥂

Ответить
@darshitapandey9305
@darshitapandey9305 - 16.09.2023 20:56

whats plen

Ответить
@notblurgaming9490
@notblurgaming9490 - 12.07.2023 17:41

while True:
plen = input("Enter the length of password: ")
if plen.isdigit():
plen = int(plen)
break
else:
print("Invalid Input")

Ответить
@pratikshajawale8129
@pratikshajawale8129 - 06.06.2023 20:55

Why you use ascii in lower and upper and not in digit

Ответить
@LaveshBansal
@LaveshBansal - 21.04.2023 14:59

plen = input("Enter password length\n")
if plen.isdigit() == True:
plen = int(plen)
print("Your password is: ")
print("".join(random.sample(s, plen)))
else:
print("Please enter only digits")

Ответить
@krishna290gamer2
@krishna290gamer2 - 17.03.2023 19:55

Suggestions:
1. You can use list(string.printables) instead of that much extend functions
2. These passwords are not practical. Use list(string.ascii_letters+string.digits)

Ответить
@okay9168
@okay9168 - 09.03.2023 07:23

handling gibberish
pattern = re.compile("[0-9]+")
if pattern.fullmatch(plen) is not None:
plen = int(plen)
else:
print("Enter number")

Ответить
@okay9168
@okay9168 - 09.03.2023 06:41

first i watched your python 15 hour course after this i started follow you😍

Ответить
@okay9168
@okay9168 - 09.03.2023 06:40

i love this project

Ответить
@shreyakumari-jw6vl
@shreyakumari-jw6vl - 06.03.2023 15:28

int(input("Enter length of password and in only in number"))
this will ur answer

Ответить
@gamerzxzu6279
@gamerzxzu6279 - 08.02.2023 10:20

what if we get the password only in symbols?

Ответить
@Factomania67743
@Factomania67743 - 11.01.2023 17:51

Sir maximum length kitni ho skti h isme

Ответить
@Vishwa_Devam
@Vishwa_Devam - 01.01.2023 08:52

You can handle gibbrish using try and except


you can use:
try:
plen = int(input("Enter the password length:\n"))
except:
sys.exit("Invalid Length")

but first of all you have to import the sys module so that you can exit it

Thx code with harry for helping us in the journey of learning this beautiful language....

Ответить
@loingaming2905
@loingaming2905 - 14.12.2022 20:52

bhaiya is tarike se to user ko khod hacker hair karna padega

Ответить
@krishcshah
@krishcshah - 29.11.2022 19:06

Finally a tutorial without import random

Ответить
@kushalyadav6900
@kushalyadav6900 - 05.11.2022 20:31

import string as st
import random as r
if __name__=="__main__":
s1=list(st.ascii_lowercase)
s2=list(st.ascii_uppercase)
s3=list(st.digits)
s4=['#', '$', '%', '&','@']

passlen=input('Enter length of password \n')

# if plen >= '0' and plen <=9:
# plen=plen(int)

if passlen in st.digits:
passlen = int(passlen)
c=[]
c.extend(s1)
c.extend(s2)
c.extend(s3)
c.extend(s4)

print('Your password is \n')
# r.shuffle(c)
# print(''.join(c[0:passlen]))
print(''.join(r.sample(c,passlen)))
else:
print('Please enter valid input \
LENGTH OF PASSWORD should be a number...')

Ответить
@indrajitmajumdar8590
@indrajitmajumdar8590 - 27.10.2022 21:20

print("".join(random.shuffle(list(s1+s2+s3+s4)))[0:64]) = 64 chr len random str.

Ответить
@abuzarsheikh7016
@abuzarsheikh7016 - 27.10.2022 20:15

Thankuuuuuuu Harish Bhaiiiiiiiiiiiiiiiiiiiiiiiiii

Ответить
@Real_Sigma_Talks
@Real_Sigma_Talks - 27.10.2022 15:47

thanks sir helps alot in working

Ответить
@krishraj3559
@krishraj3559 - 22.10.2022 23:52

Sir how to remove greater than and less then symbol from password?

Ответить
@pravin21656
@pravin21656 - 18.09.2022 10:55

Eval type casting can change

Ответить
@niteshchauhan6431
@niteshchauhan6431 - 08.09.2022 14:04

harry bhai while loop chlake check kr lenge.
if plen.isdigit():
print("".join(random.sample(s, int(plen))))

break
else:
print("enter a valid number : ")
continue

Ответить
@nilpatel9119
@nilpatel9119 - 24.08.2022 05:06

Sir kis bhi wifi password kaise pata kare

Ответить
@saransabarish7394
@saransabarish7394 - 06.08.2022 17:35

Bro you are awesome.... loved your explanation \m/

Ответить
@j4jullu
@j4jullu - 30.07.2022 15:43

very good Harry Kumar!

Ответить
@aabhasmishra3118
@aabhasmishra3118 - 22.07.2022 21:11

Error ke caught karne ke liye extension handling ka istamal karna hoga while flag == True laga ke usme try: aur excend dalna padega.

Ответить
@UzairKhan-jp7nc
@UzairKhan-jp7nc - 22.07.2022 04:09

harry bhai notes download karne mai masla ho raha hai ye error hai Application error: a client-side exception has occurred (see the browser console for more information).

Ответить
@saipi9185
@saipi9185 - 11.07.2022 19:06

❤️❤️

Ответить
@sagar1206
@sagar1206 - 22.03.2022 20:20

You can do this without the string module and only by random module to give you random password :
import random

# Random Password Generator in Python

import random

try:
list1 = ["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",1,2,3,4,5,6,7,8,9,"!","@","#","$","%","^","&","*","(",")"]
random.shuffle(list1)
user_input = int(input("Enter the length of the password: "))
password = []
for i in range(user_input):
password.append(random.choice(list1))
random.shuffle(password)
join = ''.join(map(str, password))
print(join)
except:
print("You have entered an invalid state for an integer !\n")
print("Please enter an integer as your length for the password you desire\n")
*This is a fully functional code written by me and you can use it too*

Thanks!

Ответить
@rahulrai3832
@rahulrai3832 - 28.01.2022 22:54

Tried to fix the bug, using length of input characters, except input as integers. Using if-else statements

Thanks for the project, to learn...

Ответить
@sardarwali6755
@sardarwali6755 - 12.01.2022 16:32

first of all i really really want to tanks to you for everything that i learn from you.
I haven't watched all of your videos but when ever i watch you videos i really learn something you.
sir i have a question that to be a hacker. what should i learn for hacking

Ответить
@pralayrana2187
@pralayrana2187 - 21.12.2021 19:44

Really u are great. I always follow ur YT. Thank u for ur advices.

Ответить
@mskinfinitum4378
@mskinfinitum4378 - 12.12.2021 20:44

thankyouu

Ответить
@mahisoni1750
@mahisoni1750 - 18.11.2021 00:00

Tq so much sir 🥰

Ответить
@dijukalita5005
@dijukalita5005 - 10.11.2021 17:53

👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍

Ответить
@soulstealer882
@soulstealer882 - 29.10.2021 16:58

kya hI

Ответить
@shounaksushantadasgupta8440
@shounaksushantadasgupta8440 - 22.09.2021 07:56

# Password Generator
import string
import random

s1= string.ascii_lowercase
s2= string.ascii_uppercase
s3= string.digits
s4= string.punctuation
plen=int(input("Enter Password Length:"))
s=[]
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
# print(s)
random.shuffle(s)
# print(s)
a=[]
for i in range(plen):
a.append(random.choice(s))
print(f"Password:{''.join(a)}")
print(f"Password:{''.join(random.sample(s,plen))}")

Ответить
@shashwatsrivastava6391
@shashwatsrivastava6391 - 20.09.2021 17:52

U r the best teacher

Ответить
@imgk1399
@imgk1399 - 08.09.2021 10:33

Sir aap 2 million subs ke karib ho 😄

Ответить
@pragyantiwari3885
@pragyantiwari3885 - 24.07.2021 09:53

import string
import random
try:
x = int(input('What should be the length of your password:\n'))


def Password_generator(num):
set_1 = string.ascii_uppercase
set_2 = string.ascii_lowercase
set_3 = string.punctuation
set_4 = string.digits
s = []
s.extend(list(set_1))
s.extend(list(set_2))
s.extend(list(set_3))
s.extend(list(set_4))
random.shuffle(s)
print('Your password is:', "".join(s[0:num]))


Password_generator(x)
except ValueError:
print('Input is incorrect...please try again')

Ответить
@sachinjaiswal3385
@sachinjaiswal3385 - 19.07.2021 16:15

ValueError: invalid literal for int() with base 10:

Ответить
@subhu143
@subhu143 - 14.07.2021 13:18

import string
import random
if _name_ == '__main__':
s1=string.ascii_lowercase
s2=string.ascii_uppercase
s3=string.digits
s4=string.punctuation
while True:
try:
plen=int(input("enter password lenghth:"))
s=[]
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
random.shuffle(s)
print("your password is:")
print("".join(s[0:plen]))
break
except Exception as e:
print(e)import string
import random
if _name_ == '__main__':
s1=string.ascii_lowercase
s2=string.ascii_uppercase
s3=string.digits
s4=string.punctuation
while True:
try:
plen=int(input("enter password lenghth:"))
s=[]
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
random.shuffle(s)
print("your password is:")
print("".join(s[0:plen]))
break
except Exception as e:
print(e)

Ответить
@harshithsagarkurma9055
@harshithsagarkurma9055 - 21.06.2021 06:02

@ CodeWithHarry
generate a password using a given field (like First name, Last name, Date of birth ) length of 6+

Ответить
@kailashchauhan4907
@kailashchauhan4907 - 30.05.2021 16:28

Sir this is not working in mobile , python ide pydroid.

Ответить
@whitecat4672
@whitecat4672 - 24.05.2021 12:41

How can one remember such complex passwords

Ответить
@prakharpratapsingh5188
@prakharpratapsingh5188 - 15.05.2021 07:52

import random
import string

def check_int(s):
if s[0] == '-':
return False
elif s[0] in [0,1,2,3,4,5,6,7,8,9]:
return s.isdigit()
return s.isdigit()

s1 = string.ascii_lowercase
s2 = string.ascii_uppercase
s3 = string.digits
s4 = string.punctuation
s0 = s1 + s2 + s3 + s4
s = ""

while True:
length = input("enter password length (minimum length is 4): ")
if check_int(length):
length = int(length)
break
else:
print('length can only be a positive integer')

s += random.choice(s1) + random.choice(s2) + random.choice(s3) + random.choice(s4)

for i in range(length):
s += random.choice(s0)


while True:
print(''.join(random.sample(s,len(s))))
input()

Ответить