jeudi 28 octobre 2021

Python code: If statement under while loop [duplicate]

I am working on a small project after learning a few basics about Python but in this part of the code bellow it get stuck it keeps saying "Which of the above would you like to choose: " and when I enter 1 or 2 it doesn't print anything it just repeats this "Which of the above would you like to choose: ". I am still new to coding can any of you help me find the problem in here.

str = 0 

while float (str) < 3 :
    x = input ("Which of the above would you like to choose: ")
    if x == 1 :
        print ("done")
    elif x == 2 :
        print ("done")

Thanks in regards.

Aucun commentaire:

Enregistrer un commentaire