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

Strings Concatenation, Indexing, Slicing

Concatenation Strings can be added to each other name = "Kei" message = "Good morning," print(message + name) Strings are immutable, it can’t be changed although it can be reassigned with the same variable name but they are stored in different memory location name = "Kei" message = "Good morning," print(id(message)) message = message + " " + name print(id(message)) Indexing Strings are sequence of characters therefore they can be indexed....

February 11, 2022 · 1 min · Kei