python logo

Dictionaries

Dictionaries using key-value pair for the elements Example of a Dictionary animals = { "marshmallow":"a black dog who likes to bark at things", "rudolph":"the very shiny red-nosed reindeer", "doraemon":"a cat with a pocket to access very advanced technological stuffs from the future" } I can use dir function to list the built-in methods and functions I can use to work with Dictionaries animals = { "marshmallow":"a black dog who likes to bark at things", "rudolph":"the very shiny red-nosed reindeer", "doraemon":"a cat with a pocket to access very advanced technological stuffs from the future" } print(dir(animals)) I can use keys method to see all the keys in a dictionary animals = { "marshmallow":"a black dog who likes to bark at things", "rudolph":"the very shiny red-nosed reindeer", "doraemon":"a cat with a pocket to access very advanced technological stuffs from the future" } print(animals....

February 22, 2022 · 3 min · Kei
python logo

Compound Data Types

Compound Data Type is a data made from collection of various data types like strings, integers, etc. Compound Data Types in Python can be represented by List, Dictionary, Tuple, Set. Tools I can use to work with Compound Data Types are Iterators, For loops, While loops, and other Functions List Using square brackets [ ] The elements are separated by comma Maintain order of the elements Using index to access the elements Mutable, the elements can be change [1, 2, 3, 1, True, "Kei", "Mars", 0....

February 19, 2022 · 1 min · Kei