Hello I am very new to python, any help is much appreciated.
I am having problems with line 48 the AND logical operator keeps throwing up an "invalid syntax" error. I have been trying for hours to rectify this but cannot find a solution. Can some one please help. Code shown on right and on line 48 elif current_health >50 and <70:
I am having problems with line 48 the AND logical operator keeps throwing up an "invalid syntax" error. I have been trying for hours to rectify this but cannot find a solution. Can some one please help. Code shown on right and on line 48 elif current_health >50 and <70:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
"""Made by My Adventure game""" #Import import random #Variables greeting = ( "welcome to my adventure game." ) health = 200 difficulty = 1 #Calculations monster_hit = int (random.randint( 0 , 100 ) * difficulty) monster_hit2 = int (random.randint( 0 , 100 ) * difficulty) current_health = health - (monster_hit + monster_hit2) username = input ( "Enter your first name: " ) print () print ( "-------------------------" ) print () print ( "Hello " + username.title() + ", " + greeting) #use , (Comma)to concatenate int variable and stings only. .title() capitalises the firt letter. print () print ( "Your starting health is " + str (health) + " points" ) # convert int to str when no calculations are not being performed on the integer number print () print ( "You have been hit by a monster for " + str (monster_hit + monster_hit2) + " points" ) print () print ( "After being hit, your health has dropped down to " + str (current_health) + " points." ) print () if current_health < = 0 : print ( "You have been killed by the monster, game over!" ) elif current_health> 50 and < 70 : print ( "Be careful your health is getting close to a dangerous point, it is " + str (current_health) + " Score value point" ) else : print ( "You are on the verge of dying, be careful, your health score is" + str (current_health) + "score value point" ) print (monster_hit, monster_hit2) print () |