Udacity - AI - Week2
Udacity - AI - Week2
with Python
Amir Parizi
Session 2
24 – June - 2022
● Arithmetic Operators
● Variables
Indexing
Length
● Type Function
Format() - Documentation
Split() - Documentation
Summary
● Lists
- A list is one of the most common and basic data structures in Python.
- Lists can contain any mix and match of the data types you have seen so far
● Indexing
○ Start with [0]
● Mutability : refers to whether or not we can change an object once it has been created. If an
object can be changed, it is called mutable. However, if an object cannot be changed after it has been
created, then the object is considered immutable.
○ String Vs List
● Order : is about whether the position of an element in the object can be used to access the
element. Both strings and lists are ordered. We can use the order to access parts of a list and string.
● List Functions
○ Len()
○ Max()
○ Min()
○ Sorted()
○ Join()
○ Append()
● Tuples :
○ It's a data type for immutable ordered sequences of elements. They are often used to store related pieces of
information.
○ Tuples are similar to lists in that they store an ordered collection of objects which can be accessed by their indices.
Unlike lists, however, tuples are immutable - you can't add and remove items from tuples, or sort them in place.
■ Add
■ Pop
● Sets:
○ A set is a data type for mutable unordered collections of unique elements. One application of a set is to quickly
remove duplicates from a list.
● Dictionaries
○ A dictionary is a mutable data type that stores mappings of unique keys to values.
○ Dictionaries are mutable, but their keys need to be any immutable type, like strings, integers, or tuples. It's not even
necessary for every key in a dictionary to have the same type
○ s
○ S
○ s
Summary
● Control Flow
● Functions
● Let’s take a look at the project!