I'd like to know, if I have more than one if statement, is it possible to break out of all these ifs to ask again one of the three if statement (Gent, Madam, Daughter) ?
character = {'Gent': False, 'Madam': False, 'Daughter': False}
print(character)
character[random.choice(list(character.keys()))] = True
print(character)
print("Starting up ...")
if character['Gent'] == True:
print("Hello Gent")
try:
while True:
...
if a:
...
if b:
if c:
...
character['Gent'] = False
character['Madam'] = True
...
if d:
...
elif e:
...
if character['Madam'] == True:
print("Hello Madam")
try:
while True:
...
if a:
...
if b:
if c:
...
character['Madam'] = False
character['Daughter'] = True
...
if d:
...
elif e:
...
...
I start randomly between Gent, Madam or Daughter, once in the code I would like to change the character if certain conditions are met, but once in one of these 3 if statement, I get stuck inside and I can't to go out again to be able to change the character.
PS: I am new to Python
Aucun commentaire:
Enregistrer un commentaire