How do I print on the same line?

QuestionsQuestions4 SkillsProPython Control StructuresNov, 17 2025
0105

To print each letter of "PYTHON" on the same line, you can use the print() function with the end parameter set to an empty string or a space. Here's how you can do it:

word = "PYTHON"

for letter in word:
    print(letter, end=' ')  # Use end=' ' to add a space between letters

When you run this code, the output will be:

P Y T H O N 

If you want the letters to be printed without any space, you can set end='':

for letter in word:
    print(letter, end='')  # No space between letters

This will output:

PYTHON

Feel free to ask if you have more questions!

0 Comments

no data
Be the first to share your comment!