paint-brush
How to Use Dictionaries as an Alternative to If-Elseby@khuyen-tran
5,133 reads
5,133 reads

How to Use Dictionaries as an Alternative to If-Else

by Khuyen Tran3mFebruary 13th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

How to Use Dictionaries as an Alternative to If-Else Statements with the Bonus of Default Values. Python’s dictionaries method called get() looks up a key and returns default value with the non-existent key. Get() returns a default value when no key is found. Python's dictionaries can create an ordered dictionary, group multiple dictionaries into a single mapping, create a read-only dictionary, you could found out more here. The function that does not involve a dictionary is called find_price().

Company Mentioned

Mention Thumbnail
featured image - How to Use Dictionaries as an Alternative to If-Else
Khuyen Tran HackerNoon profile picture
Khuyen Tran

Khuyen Tran

@khuyen-tran

Mathematics + Data Science

Learn More
LEARN MORE ABOUT @KHUYEN-TRAN'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Khuyen Tran HackerNoon profile picture
Khuyen Tran@khuyen-tran
Mathematics + Data Science

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite