Write a Python program to check whether an alphabet is a vowel or consonant


Introduction

Write a Python program to check whether an alphabet is a vowel or consonant. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. str = input("Input a letter of the alphabet: ")
  2.  
  3. if str in ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U', 'A', 'E'):
  4. print("%s is a vowel." % str)
  5. elif str == 'y':
  6. print("Sometimes letter y stand for vowel, sometimes stand for consonant.")
  7. else:
  8. print("%s is a consonant." % str)
  9.  

Result

python language techstudy.org

     





Related Topics




Popular Posts