Lists Tuples and Dictionaries | python for beginners | python full course
Krishna The Maker
Lists:
- Lists are ordered collections of items that can be of any data type, including other lists.
- Lists are defined using square brackets [] and items are separated by commas. For example,
[1, 2, 3]
is a list with three items. - Lists can be indexed (accessed) using integer keys, starting at 0. For example,
my_list[0]
would return the first item in the list. - Lists can be sliced to extract a subset of the items. For example,
my_list[1:3]
would return the second and third items in the list.
Tuples:
- Tuples are similar to lists, but they are immutable, meaning they cannot be changed once they are created.
- Tuples are defined using parentheses () and items are separated by commas. For example,
(1, 2, 3)
is a tuple with three items. - Tuples cannot be altered or resized, but they can be indexed and sliced like lists.
Dictionaries:
- Dictionaries are unordered collections of key-value pairs, where each key is unique and maps to a specific value.
- Dictionaries are defined using curly braces {} and keys are separated from values using a colon. For example,
{ 'name': 'Shako', 'age': 3 }
is a dictionary with two key-value pairs. - Dictionaries can be accessed using their keys, and values can be retrieved using the index notation. For example,
my_dict['name']
would return the value associated with the key 'name'.
š Welcome to the Ultimate Python Journey with KGrebel_official !! š š Connect and Engage: Got questions? Looking for coding support or just want to connect with fellow learners? Join our vibrant community on Telegram - https://t.me/+9FT6frCMfXw5Mzc1 .
Full Stack Web Development Tutorials in Hindi Playlist https://www.youtube.com/playlist?list=PL1DsB_Om8LWptrKolY2jEiV8qYTKy4sST
⢠ā Full stack web development Hindi Tutorials
Official Website
Follow us on Facebook
Follow us on Twitter
#python , #pythontutorials , #pythonprogramming ... https://www.youtube.com/watch?v=1Z2OUq8mx6s
2023-10-13
0.0 LBC
Copyrighted (contact publisher)
43988500 Bytes