How to insert string into a string as a variable?

前端 未结 7 495
野的像风
野的像风 2021-01-06 09:25

I\'m trying to create a program and one thing I\'m trying to do is add variables to a string like so.

EnemyHealth = 0  

EnemyIs = \'dead\'

print(\"The Enem         


        
相关标签:
7条回答
  • 2021-01-06 10:28

    Use print with format, it makes your code look good

    print("The Enemy's health is {} The Enemy is {}".format(str(EnemyHealth),EnemyIs)
    
    0 讨论(0)
提交回复
热议问题