samedi 6 juillet 2019

Why does my code not like this variable? Why is else not working?

Python 3.7 issue.

I'm writing a D&D Character sheet layout with calculators for the inputs. The idea is that if something happens to the character I can update the layout to include it. Such as loss of HP.

So the stats are in a loop and when you get to the end it asks for inputs to update it in the next refresh.

But when I try to write a variable for this particular area it carks it.

And the else statement (also tested on other code) also is hated by the program and when I remove it I get EOF errors.

TL;DR Else statement doesn't work. Variable doesn't work.

Said variable I have changed 3 times and run it on other code with it working fine same with the else.

update = input("Update? ")
    if update == "Long Rest":
        HP = (8+CM + ((Level-1)*(HitDice+CM)
    else:
        print (" ")


    repeat = input("Continue? ")
    if repeat == "Finish":
        Finished = True
    else:
        Finished = False

Finished is a while loop

Whenever I try to run the code I get a pop up box saying "Invalid Syntax".

I'm kind of new to coding but I did look for a similar answer but all the ones I found didn't work.

Aucun commentaire:

Enregistrer un commentaire