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,140
  • 22
  • 39
m0bi5
  • 8,900
  • 7
  • 33
  • 44

2 Answers2

2

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

Instead, use:

word = "Marble"
print word 

Marble
Paul
  • 26,170
  • 12
  • 85
  • 119
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,353
  • 3
  • 30
  • 41