Answer to Question #330144 in Python for Pirate

Question #330144

You are given a word as input. Print the input by adding a hyphen (-) between each letter in the word.


The input is a string


Sample input == Hello


Output == H-e-l-l-o

1
Expert's answer
2022-04-18T08:39:55-0400
data = input("Please enter your text: ")

for i in range(len(data)):
    if i != len(data) - 1:
        print(data[i] + '-', end='')
    else:
        print(data[i])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS