Python Code Text Game -


player_health = 100  power = 10  enemy_health = 50  player_name = input('what name, guardian? ')  print('hello ' + player_name + ' guardian')  player_element = input('would guardian of air, earth, fire or water? ')  if player_element == 'air':     print('you have been granted powers of air, guardian.\           have powers of wind , sky.')  if player_element == 'earth':     print('you have been granted powers of earth, guardian.\           have powers of earth.')  if player_element == 'fire':     print('you have been granted powers of fire, guardian.\           have powers of fire. not destroy wish.')  if player_element == 'water':     print('you have been granted powers of water, guardian.\           have powers control oceans , water.')  print('there enemy in distance! do?')  player_action = input('what do ' + player_name + '? ' + 'type attack ')  if player_action == 'a':     print('the enemy\'s health @ ' + enemy_health + '! ' 'keep attacking guardian!')  enemy_health = print(enemy_health - power)  

in last block of code, want print out the enemy's health @ 40!(because power - enemy_health = 40) keep attacking guardian!' tips? gets error of cant convert int object str implicitly.

you cannot concatenate string integer, instead can use format

print('the enemy\'s health @ {}! keep attacking guardian!'.format(enemy_health)) 

for use + operator , perform concatenation, you'd first have create string first

print('the enemy\'s health @ ' + str(enemy_health) + '! keep attacking guardian!' 

you need modify health, i'm not sure think doing

enemy_health = print(enemy_health - power)  

you should change to

enemy_health = enemy_health - power 

Comments