We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hey glad to hear you liked it...!!
I am also learning and new to programming , so I try to make codes simple in a way every beginner can understand . As I believe you always have choice to write better codes but first one needs to understand it fully.
Coming to your question using dictionary will be faster than using if-else.
Moreover I would say if you are comfortable using dictionary at first use it , if it does'nt works on some cases then use if-else. Presently I am more comfortable using if-else so I used it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Python If-Else
You are viewing a single comment's thread. Return to all comments →
Hey glad to hear you liked it...!! I am also learning and new to programming , so I try to make codes simple in a way every beginner can understand . As I believe you always have choice to write better codes but first one needs to understand it fully. Coming to your question using dictionary will be faster than using if-else. Moreover I would say if you are comfortable using dictionary at first use it , if it does'nt works on some cases then use if-else. Presently I am more comfortable using if-else so I used it.