Print Consonants

Question

From the string :

s=”I love to learn from The Data Monk”

Print only those characters that are consonants.

in progress 0
YashikaKhurana 55 years 2 Answers 751 views Master 0

Answers ( 2 )

  1. s=”I love to learn from The Data Monk”
    vowels=[“a”, “e”, “i”, “o”, “u”, “A”, “E”, “I”, “O”, “U”]
    for i in range(len(s)):
    if s[i] in vowels:
    pass
    else:
    print(s[i])

  2. s=”I love to learn from The Data Monk”

    for i in s.lower():
    if i not in (“a”, “e”, “i”, “o”, “u”):
    print(i)

Leave an answer

Browse
Browse