I need to write a python program that generates random movie titles depending on the movie genre (action, romance, horror etc...)
So after thinking about it for a little bit I came up with this:
action_movie_noun = ["Snake", "Army", "Rebels"]
action_movie_verb = ["Fight", "Destroy", "Punch"]
action_movie_adj = ["Extreme", "Awsome", "Great"]
if movie.genre == "Action":
movie_title_choice = random.randint(1,2)
if movie_title_choice == 1:
movie.name.append(random.choice(action_movie_adj))
movie_title_choice = random.randint(1,2)
if movie_title_choice == 1:
movie.name.append(random.choice(action_movie_noun))
movie.name.append(random.choice(action_movie_verb))
else:
movie.name.append(random.choice(action_movie_noun))
else:
movie.name.append(random.choice(action_movie_adj))
movie.name.append(random.choice(action_movie_verb))
The idea is to randomly generate sentences like that with different structures. Is there a better way to do this? I know there is a lot of those random generators on the net so I was wondering if there was a particular formula for them or if my idea was the right one.
Thanks
Aucun commentaire:
Enregistrer un commentaire