python logo

Lists

Lists using square brackets [] Example of Lists int_list = [1, 20, 77, 800, 39, 21, 5] str_list = ["python", "javascript", "java", "rust", "go", "dart"] print(int_list) print(type(int_list)) print(str_list) print(type(str_list)) Some of the things that I could do with lists: Sort the values in ascending or descending order Find values in list or details about the list Insert or remove values from the list Get a sub-list from the list Iterate through the list and perform functions or checks on each list item Some functions that could help me work with lists:...

February 22, 2022 · 4 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