mardi 22 juin 2021

TypeError: 'builtin_function_or_method' object is not subscriptable string

I have been trying to fix this for a while and have tried a lot of things but none have worked am I am new-ish to coding and would really appreciate if anyone knows how to fix this I am having errors with the bits circiled in red code:

def playGame():
    playInput = str(input('Would you like to play a number guessing game? ')).lower
    if playInput[0] == 'y':
        print('Ok, Lets Start.')
        time.sleep(1)
        startRound()
    elif playInput[0] == 'n':
        print('Ok :( Bye')
        time.sleep(0.5)
        exit()
    else:
        print('Please enter a valid answer (Y/N)')
        time.sleep(1)
        playGame()

enter image description here

Aucun commentaire:

Enregistrer un commentaire