Advertisement
JkSoftware

Day 5 - Challenge Password Gen

Nov 8th, 2021
920
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. letters = ['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']
  3. numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
  4. symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+']
  5.  
  6. print("Welcome to the PyPassword Generator!")
  7. nr_letters= int(input("How many letters would you like in your password?\n"))
  8. nr_symbols = int(input(f"How many symbols would you like?\n"))
  9. nr_numbers = int(input(f"How many numbers would you like?\n"))
  10.  
  11. list1 = []
  12.  
  13.  
  14. for n in range(0, nr_letters):
  15.     list1.append(random.choice(letters))
  16.  
  17. for n in range(0, nr_numbers):
  18.     list1.append(random.choice(numbers))
  19.  
  20. for n in range(0, nr_symbols):
  21.     list1.append(random.choice(symbols))
  22.  
  23.  
  24. random.shuffle(list1)
  25. print(list1)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement