0
#starting values
Playerlives = 3
Playerhealth = 100
Playerdamadge = 10
Computerlives = 3
Computerhealth = 100
Computerdamadge = 10


#function for players attack move
def attackMove():
    Computerhealth = (Computerhealth - Playerdamadge)
    if Computerhealth <= 0:
        Computerlives = (Computerlives - 1)
        Computerhealth = 100
    else:
        print("you have hit the computer for"
        , Playerdamadge ,"damadge, leaving it on",Computerhealth ,"health")

#my error states that Computerhealth hasnt been defined and that its been refereced before assignment, #on the line "Computerhealth = (Computerhealth - Playerdamadge)" , the first reference to Computerhealth is recognised as 100 but the second one isnt

0 Answers0