Answer to Question #225351 in Python for kaavya

Question #225351

Hyphenate Letters:

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

Input

The first line of input is a string W.

Explanation

In the given example, the word is Hello.

So, the output should be

H-e-l-l-o.

Sample Input 1

Hello

Sample Output 1

H-e-l-l-o

Sample Input 2

Everyone

Sample Output 2

E-v-e-r-y-o-n-e




1
Expert's answer
2021-08-11T14:12:18-0400
W = input()
W = '-'.join(W[i:i + 1] for i in range(0, len(W), 1))
print(W)

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