Can I make random letters using Python and How?? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

Can I make random letters using Python and How??

I am thinking of making a password Generator program by combining random numbers and letters.I recently learnt how to create random numbers in Python by importing a module named 'Random'.Now I need to know how to make random letters to combine with random numbers to create a password

18th Apr 2020, 1:49 PM
Narūto Primē
Narūto Primē - avatar
2 Antworten
+ 4
To generate ramdom characters and special characters you can use the modul ramdom. Import choice or choices from this module. Then create a list or a string LS with all characters you wanted to use. By using random.choice you define LS, and run this in a loop to get n characters out of LS. By using random.choices you can generate the resulting characters without using a loop, but you can pass an argument k = 10 to get 10 characters. It is also possible to give a weights argument.
18th Apr 2020, 3:07 PM
Lothar
Lothar - avatar
+ 1
You can use lists to do so.
18th Apr 2020, 2:22 PM
Pranav Kalro
Pranav Kalro - avatar