samedi 4 avril 2020

Python: if/else inside a while loop problem multiple choice answer [duplicate]

I am new to python code someone please help me becasue it's important for my coding project. I need help to solve my problem becasue i don't know what to do. For this code i would like for it to have the person who is running the code to choose his options and so it also print out the statments.

 powers = '1' or '2' or '3'
 while powers != '1' or '2' or '3':
    powers = input('Choose one of these numbers 1,2,3 to get your power ')
    if powers == 1:
        print('You have picked power 1 which increase your health by 40 ')
    elif powers == 2:
        print('You have picked power 2 which increase your strength by 40 ')
    elif powers == 3:
        print('You have picked power 3 which gives you a weapon ')

Aucun commentaire:

Enregistrer un commentaire