jeudi 1 octobre 2020

can you review this python 3.7 code and tell me whats wrong in it? [duplicate]

import time as t
while True:
    choice = int(input("Choose a number between 10 and 1000: "))
    if choice > 1000:
        print("checking...")
        t.sleep(1.5)
        print("Please choose a number less than 1000.")
    elif choice < 10:
        print("checking...")
        t.sleep(1.5)
        print("please choose a number less than 10.")
    else:
        print("checking...")
        t.sleep(1.5)
        print("Everything's good!")
        t.sleep(0.5)
        change = str(input("Do you want to change it? "))
        if change.capitalize == "Yes" or "Yeah":
            print(f'the number you chose was {choice}')
            break
        
        else:
            
            continue

This code works just fine but when it asks you "do you want to change it?"

it doesn't matter what you answer even if it was a no or anything else

it will execute the if command which is:

if change.capitalize == "Yes" or "Yeah":
            print(f'the number you chose was {choice}')
            break

Am sorry if this question is kind of silly am still semi-intermediate at python and this is my second time asking a question here

Aucun commentaire:

Enregistrer un commentaire