Match case or switch case in Python

0

 Match case or switch case in Python:-



It  is  used to solve option based or choice based program. it is similar to ladder if--else.


ch='i'

match ch:

 case 'a':

    print('vowel')

 case 'e':

    print('vowel')

 case 'i':

    print('vowel')

 case 'o':

    print('vowel')

 case 'u':

    print('vowel')

 case _:

    print('consonent')



Tags

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)