Python Program to Print a Hyphen between each letter in the word

 

Python Program to Print  a Hyphen between each letter in the word

Hyphenate Letters | Python Program to Print  a Hyphen between each letter in the word

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-I-o

Code

w=input()
hypen="-"
string=""
length=len(w)
for i in w:
    string=string+i+hypen
string=string.strip("-")
print(string)
    

Sample Input: 

Everyone

Sample output: 

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

Comments

Popular posts from this blog

CODING ASSIGNMENT 4

CODING PRACTICE 11 Music Page

CCBP Static Website Coding Assignment 2 Solution | Yoga Page