lundi 9 octobre 2023

is there a particular way to randomly generate items based on two different options? [closed]

I am creating a program where it randomly generates hairstyles which I made a list for based on the gender you pick, male or female. Basically it starts with what is your gender, then asks what category of hairstyle do you want then it's supposed to then randomly generate a hairstyle from my list.

this is my code for now

import random

Male_natural_hairstyles=['afro', 'buzzcut', 'fade', 'waves', 'bald', 'classic haircut']


def blk_hairstyles():
    
    gender=""
    while gender=="":
        gender= input("What is your gender, male or female? ")
        
    if gender=="male":
        
        category=""
        
        category=input("what category do you want: natural or protective? ")
        
    if gender=="male" and category=="natural":
        
        blk_hairstyles= random.choices(Male_natural_hairstyles)
    
    
        
        
print (blk_hairstyles())



Aucun commentaire:

Enregistrer un commentaire