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
  • 39,665
  • 11
  • 104
  • 149

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
  • 16,488
  • 11
  • 47
  • 80