0
How to implement switch in python
3 Answers
+ 2
Check out this lesson :
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2450/?ref=app
+ 1
0
are you talking about something like in C++:
switch var{
case 1: code to execute if var==1;
case 2: code to execute if var==2;
case 3: code to execute if var ==3;
}
...then I am also interested in the answer. Switch is super helpful to avoid huge if...else chains, imo, but I didn't see it addressed in the basic python lesson.