lundi 23 mai 2022

how do I generate random group names using lists

I can not figure out my mistake. Can someone help me?

We are supposed to create the lists outside of the function. then create an empty list inside a function. We should return 9 different names.

    first_names = ["Gabriel", "Reinhard", "Siebren"]
    last_names = ["Colomar", "Chase", "Vaswani"]

    def name_generator(first_names, last_names):
        full_name= ()

    import random

    for _ in range(9):
        full_name=random.choice(first_names)+" "+random.choice(last_names)
        full_name.append(full_name)
    group_string = ", ".join(full_name) 



Aucun commentaire:

Enregistrer un commentaire