Data Structures Lists, Dictionaries, Tuples, Sets, Strings in Python | Python Tutorial for Beginners
In this video I am going to show How to use different Data Structures in Python 3. The built ins data structures are: lists, tuples, dictionaries, strings, sets and froze sets.
Data structures are particular ways of storing data to make some operation easier or more efficient.
Lists:
----------------------
A List in Python is a kind of Collection that allows us to put many values in a single “variable”. A collection is nice because we can carry all many values around in one convenient package. So What is a List? List is An ordered set of values:
Ordered: 1st, 2nd, 3rd, …
Values: can be anything, integers, strings, other lists
List values are called elements. A string is an ordered set of characters so it is “like” a list but not exactly the same thing.
Tuples:
----------------------
Python Tuples are another kind of sequence that functions similar to a list - they have elements which are indexed starting at 0. But Tuples are "immutable" i.e. Unlike a list, once you create a tuple, you cannot alter its contents.
So Tuple is an an immutable sequence which is Very similar to a list but Tuple is created it cannot be changed
Format: tuple_name = (item1, item2)
Tuples support operations as lists i.e. Subscript indexing for retrieving elements, Also Methods such as index, Built in functions such as Len, min, max, Slicing expressions, The in, +, and * operators. Tuples do not support the methods like append, remove
insert, reverse, sort.
Advantages for using tuples over lists:
1)Processing tuples is faster than processing lists
2)Tuples are safe
3)Some operations in Python require use of tuples
list(tuple_var) function: converts tuple to list
tuple(list_var) function: converts list to tuple
Python Sets:
----------------------
So What are Sets in python? Sets are An unordered collection with no duplicate elements. Sets are Identified by curly braces e.g. {'Max', 'Tom', 'Den'}. Python Sets Can only contain unique elements, Duplicates are eliminated automatically at the time of initialization. Sets have no order and also Sets do not support indexing. Sets in Python can also be be used to perform mathematical set operations like union, intersection, difference and symmetric difference.
Python Dictionary:
----------------------
So What are Dictionaries in python?
dictionary in python is an associative list or a map.
We can think if dictionary as a list of pairs, where the first element of the pair, the key, is used to retrieve the second element, the value. Hence we map a key to a value. Dictionaries are Python’s most powerful data collection. Dictionaries allow us to do fast database-like operations in Python. Dictionaries are like Lists except that they use keys instead of Index to lookup values.
Python Slice:
----------------------
So What is Python Slice? A slice is a span of items that are taken from a sequence
List slicing format: list[start : end: step]. Span is a list containing copies of elements from start up to, but not including, end
If start not specified, 0 is used for start index. If end not specified, len(list) is used for end index. Slicing expressions can include a step value and negative indexes relative to end of list.
And What is Negative Indexing In Python: I a Python Collection such as Lists, Strings, Tuples, Bytes .. we can refer to an element by a negative index representing how far it is from the end.
example
+---+---+---+---+---+---+
| P | y | t | h | o | n |
+---+---+---+---+---+---+
0 1 2 3 4 5 ---- Positive Index
6 5 -4 -3 -2 -1 -- Negative Index
NEW VIDEO EVERY OTHER WEEK - Subscribe ➜ / @englishtechnology
Share this Video ➜ • Data Structures Lists, Dictionaries, Tuple...
▬▬▬▬▬▬ Courses and Tutorials on YouTube 🎬 ▬▬▬▬▬▬
Tableau Full Course Tutorial➜ • Tableau Full Course | Data Visualization a...
POWER BI Full Course➜ • Power BI Full Course | Power BI Tutorial f...
SEO Bootcamp➜ • Complete SEO Bootcamp - Most Extensive Tra...
FLUTTER Full Course➜ • Flutter Full Course | Flutter Tutorial for...
CYBER SECURITY Bootcamp➜ • Complete Cyber Security Bootcamp | Cyber S...
EXCEL Bootcamp➜ • The Excel Bootcamp | Excel Tutorial for Be...
Python Full Course➜ • PYTHON Full Course - Beginners to Super - ...
SQL & Databases Bootcamp➜ • How to Learn SQL and Databases Full Course...
HTML & CSS Full Course➜ • HTML & CSS Full Course | HTML & CSS Tutori...
Java Programming Full Course➜ • Java Programming Full Course | Java Progra...
HTML Full Course➜ • HTML Crash Course | HTML Tutorial for Begi...
DOCKER Full Course➜ • DOCKER Full Course | Docker Tutorial for B...
GOLANG Full Course➜ • GOLANG Full Course | GO Programming Tutori...
BOOTSTRAP 5 Full Course➜ • Bootstrap 5 Full Course | Bootstrap 5 Tuto...
BASH & SHALL Full Course➜ • Bash Shell Scripts Full Course | Bash Shel...
JENKINS Full Course➜ • Jenkins Full Course For Developers and Dev...
KUBERNETES Full Course➜ • Kubernetes Crash Course for Absolute Begin...
MongoDB Full Course➜ • MongoDB Full Course | MongoDB Tutorial for...
Web & Mobile Design UI UX, Figma Full Course➜ • Learn UI/UX Design for Web & Mobile: Full ...
#python #learnpython #training #tutorial #beginners #freecourse
Auf dieser Seite können Sie das Online-Video Data Structures Lists, Dictionaries, Tuples, Sets, Strings in Python | Python Tutorial for Beginners mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer English Technology 15 August 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 104 Mal angesehen und es wurde von 8 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!