1

I have the following code:

word = "Marble"
for char in word:
    print char

The Output:

M
a
r
b
l
e

How can I make console print

Marble

Anonymous Coward
  • 3,071
  • 21
  • 38
m0bi5
  • 8,298
  • 7
  • 30
  • 42

2 Answers2

2

To print the entire word, the for loop is unnecessary.

Instead, use:

word = "Marble"
print word 

Marble
Paul
  • 24,493
  • 12
  • 81
  • 118
0

You mean print without a new line.

import sys
word = "Marble"
for char in word:
    sys.stdout.write(char)

For more detail, see this

Community
  • 1
  • 1
luoluo
  • 5,133
  • 3
  • 28
  • 40