221k views
1 vote
PYTHON

Given a word from a user

word = input("Enter a word: ")
Show how you would go through and print each character twice. For example, if the user typed "peanut", you program should print:

ppeeaannuutt


PLEASE HELPPPPPP

User Rafsanjani
by
5.6k points

1 Answer

4 votes

word = input("Enter a word: ")

for x in word:

print(x*2, end="")

first, get the user input for the word. Then, using a for loop, iterate through the user's word. Print each letter twice (that's what the times 2 is used for) and end the print statement with no new line.

User Shanakay
by
6.8k points