0

How to rewrite this for Python 3?

for ch in "WELCOME TO EARTH!".center(35):
    print ch,

It should print like this:

                       W E L C O M E   T O   E A R T H!

I tried just putting brackets around like this but it didn't work:

for ch in "WELCOME TO EARTH!".center(35):
    print (ch,)
Aran-Fey
  • 35,525
  • 9
  • 94
  • 135

1 Answers1

3

Try:

for ch in "WELCOME TO EARTH!".center(35):
    print(ch, end='')

You can read about the end argument here.

Colin Ricardo
  • 15,150
  • 9
  • 42
  • 74