Reputation: 63
print("ENEMY Health is ", (int(ehealth), ' / ', (int(emaxHealth))), sep='')
Should look like:
ENEMY Health is 100 / 100
but it looks like this:
ENEMY Health is (100, ' / ', 100)
Whats the go with this?
Upvotes: 0
Views: 355
Reputation: 9652
By enclosing the health ratio in brackets, you are creating on the fly a Python tuple. Calling print
on that tuple will result in printing its string representation.
So you have three elements enclosed in brackets and separated by commas, two of them being numbers (no quotes), and the one in the middle being a string (hence the quotes).
Your line of code could be:
print("ENEMY Health is {0} / {1}".format(ehealth, emaxHealth))
Upvotes: 2
Reputation: 9
Im more familiar with java is but I I think maybe change to quote's! print("ENEMY Health is ",(int(ehealth), "/" ,(int(emaxhealth)))) or take out quotes and apostrophies and leave the / where it is. hope this helps!
Upvotes: 0
Reputation: 174766
Remove the brackets present inside the print function.
>>> ehealth = 100
>>> emaxHealth = 100
>>> print("ENEMY Health is ",str(ehealth),' / ',str(emaxHealth), sep='')
ENEMY Health is 100 / 100
OR
>>> print("ENEMY Health is "+str(ehealth)+' / '+str(emaxHealth))
ENEMY Health is 100 / 100
OR
>>> print("ENEMY Health is {} / {}".format(ehealth, emaxHealth))
ENEMY Health is 100 / 100
Upvotes: 1