-2

I am trying to write out a program that tells how much damage someone causes to an object and i want to also print out how much damage it delt, but even after looking what I found doesn't seem to work. Here is the code

damage = random.randint(1,3)
print ("You delt %"+damage+"% damage")

If any one knows why it isn't working I would be very thankful.

timgeb
  • 76,762
  • 20
  • 123
  • 145
cryce
  • 1
  • 1

1 Answers1

2
print ("You delt %" + str(damage) + "% damage")
You delt %1% damage

better way:

print ("You delt %{}% damage".format(damage))
Wanming Zhang
  • 323
  • 1
  • 8