Why doesn't this print with spaces.

edited May 2017 in Python Mode

it prints like: You have20lives left

I want it to print like: You have 20 lives left

(This is for my brickbreaker game)

lives = 20
c = ("You have   %i   lives left" % (lives))         
print(c)
Tagged:

Answers

  • c = ("You have %i lives left" % (lives))
    print(c)

  • what language is this?

  • edited May 2017 Answer ✓

    It works for me in Python Mode from PDE v3.3. Windows 8.1 64-bit laptop here. >-)
    It prints: You have 20 lives left.. ;;)

    lives = 20
    c = 'You have %i lives left.' % lives
    print c
    exit()
    
  • edited May 2017 Answer ✓

    Same code, but for JS now: O:-)

    lives = 20
    c = `You have ${lives} lives left.`
    console.info(c)
    
  • Thank you GoToLoop. You are a genius

Sign In or Register to comment.