0

How to implement switch in python

27th Jun 2018, 7:09 PM
sweta umrao
sweta umrao - avatar
3 RĂ©ponses
28th Jun 2018, 1:52 AM
$±𝐎â‚č𝔭!𝐹𝓝
$±𝐎â‚č𝔭!𝐹𝓝 - avatar
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.
27th Jun 2018, 11:30 PM
E. Smith
E. Smith - avatar