u know program to generate random password in python code example

Example 1: python random password generator

import random

alph = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ\
             abcdefghijklmnopqrstuvwxyz\
             1234567890 !@#$%^&*(){}[]<>,.')
out = ''
for char in string:
    out += random.choice(alph)
    
print(out)

Example 2: randomly generated password python

import random
import os

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', ]

def random_password_generation():
  randnum = random.randrange(0, 10)
  randletter = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter = randletter.lower()
  else:
    randletter = randletter.upper()

  randnum2 = random.randrange(0, 10)
  randletter2 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter2 = randletter2.lower()
  else:
    randletter2 = randletter2.upper()

  randnum3 = random.randrange(0, 10)
  randletter3 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter3 = randletter3.lower()
  else:
    randletter3 = randletter3.upper()

  randnum4 = random.randrange(0, 10)
  randletter4 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter4 = randletter4.lower()
  else:
    randletter4 = randletter4.upper()

  randnum5 = random.randrange(0, 10)
  randletter5 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter5 = randletter5.lower()
  else:
    randletter5 = randletter5.upper()

  randnum6 = random.randrange(0, 10)
  randletter6 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter6 = randletter6.lower()
  else:
    randletter6 = randletter6.upper()

  randnum7 = random.randrange(0, 10)
  randletter7 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter7 = randletter7.lower()
  else:
    randletter7 = randletter7.upper()

  randnum8 = random.randrange(0, 10)
  randletter8 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter8 = randletter8.lower()
  else:
    randletter8 = randletter8.upper()

  randnum9 = random.randrange(0, 10)
  randletter9 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter9 = randletter9.lower()
  else:
    randletter9 = randletter9.upper()

  randnum10 = random.randrange(0, 10)
  randletter10 = random.choice(letters)

  if(random.randrange(0,2) == 1):
    randletter10 = randletter10.lower()
  else:
    randletter10 = randletter10.upper()

  random_password = (randnum, randletter, randnum2, randletter2, randnum3, randletter3, randnum4, randletter4, randnum5, randletter5, randnum6, randletter6, randnum7, randletter7, randnum8, randletter8, randnum9, randletter9, randnum10, randletter10)

  random_password = str(random_password)

  print('randomly generated password:', random_password.replace("'", "").replace(" ", "").replace(",", "").replace(",", "").replace(")", "").replace("(", ""))

  print(' ')

  again_ask()

def again_ask():
  again = input('again? y/n: ')
  again = again.lower()

  if(again == 'y'):
    os.system('clear')
    random_password_generation()

  elif(again == 'n'):
    os.system('clear')
    print('Ok then.')
    exit()

  elif(again != 'y' or 'n'):
    print(' ')
    print('do it propper this time!')
    print(' ')
    again_ask()

random_password_generation()
again_ask()