How to implement switch in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to implement switch in python

27th Jun 2018, 7:09 PM
sweta umrao
sweta umrao - avatar
3 Answers
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