+ 1

Which statement use in python for switch?

I need switch case.Plz help any one

16th Apr 2018, 4:42 AM
Mohammad Umair
Mohammad Umair - avatar
6 Answers
+ 6
Python doesn't have switch statements, so you will have to do as Mickel SĂĄnchez suggested: if condition: #do something elif condition: #do something else: #do something else
16th Apr 2018, 4:59 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
The alternative is if - elif - else as far as I know. Although for me it usually looks ugly.
16th Apr 2018, 4:53 AM
Mickel
Mickel - avatar
16th Apr 2018, 5:00 AM
Mickel
Mickel - avatar
+ 2
thx
16th Apr 2018, 4:54 AM
Mohammad Umair
Mohammad Umair - avatar
+ 2
thanks
16th Apr 2018, 5:03 AM
Mohammad Umair
Mohammad Umair - avatar
+ 1
How to use
16th Apr 2018, 4:54 AM
Mohammad Umair
Mohammad Umair - avatar