Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ddephor45117yUse a dictionary and put the code to execute in functions:
def funcA():
startWorldDomination()
def funcB():
raiseUnicorns()
def funcC():
rmRfRoot()
dictCase ={ 1:funcA, 2:funcB, 3:funcC }
searchItem = input("Enter number from 1-3")
dictCase[searchItem]() -
Cieric137yI've been thinking about possibly learning python, guess this is another thing for me to dislike about it.
-
Cieric137y@rising Well it has always been something I though about learning but I've never really had a HUGE use for it. I've used it for a bunch of small projects (like 30 lines or so) But it's been so sparse that I never memorize the syntax. On top of all that I work on a lot of high performance applications so python has always been a little slow.
Oh and don't get me wrong I do plan on learning python enough to read over programs, but using it on a daily basis is something I'd like to avoid for now.
Related Rants
So Python doesn't have switch-case statement... I feel so dirty having to use multiple if-elif-else
*sigh*
rant
if statement
python
switch_case