Back

Codekata - problem facing to find consonants in the string?

Created 3 years ago
273 Views
1 Comments
GokilaE
@GokilaE
GokilaE
@GokilaEProfile is locked. Login

You are given a string. Your task is to print only the consonants present in the string without affecting the sentence spacings if present. If no consonants are present print -1

Input Description:
You are given a string ‘s’.

Output Description:
Print only consonants.

Sample Input :

I am shrey

Sample Output :

m shry

a = input()
r = 0
for i in a:
    if i not in 'aeiou':
        print(i,end ="")
        r += 1
if r == 0:
    print(-1)

I Have made the correct logic and I got the output in my ide but while submitting in codekata I faced in testcase failed. Anyone can explain it.

Comments
Please login to comment.