dimanche 11 août 2019

Python: if, elif, else. Error: SyntaxError: bad input on line 6 in main.py

I have a bug I'm trying to eradicate for a project I'm working on.

SyntaxError: bad input on line 6 in main.py

I intend to give credit where credit is due.. Whoever helps me solve this can work out how they want to receive the comment in my code.

I don't know what to try.
EDIT: https://trinket.io

    if save == 'y':
      filename = 'storage.json'
    with open(filename, 'w') as f_obj:
          json.dump(box, f_obj)
    print(storage)
    elif save == 'n':
      input('another box?')
    else:
      print('i don't understand your input')

I want to save variables into retrievable storage when it powers back on.

When a user types "y", the variable will save.

When a user types "n", the user will be asked if they need to create another box.

When a user types anything else, they will be told "i don't understand..."

Aucun commentaire:

Enregistrer un commentaire