samedi 30 novembre 2019

Generate random names

Can someone please help me, i can't seem to figure it out:

exercise: "Add another function to your design, which is now to create and return names according to the specifications in the introduction. Comment out the main function from the first step (do not remove it completely!) and output 100 randomly generated names in a new main function.

The output looks like this: Hadrian Steiner-Jakobi Lucia Sommer Dr. Jo Hintz André Schultheiß Rupert Richter Dr. Anja Fobbe Barbara Pradela Julian-Adrienne Wolfram-Ossege "

i've already created a main function that generates a random male and female full name

import random
man = [a list of male names] 
woman = [list of female names]
lastname = [list of last names]

gen = random.choice(man)
gen2 = random.choice(woman)
gen3 = random.choice(lastname)
def main():
    return print(f'{gen}-{gen3}\n{gen2}-{gen3}')
main()

but i can't figure it out how to add random "dr." and "-" to these names thanks




Aucun commentaire:

Enregistrer un commentaire