cadurseg_Programacion_II_Clases
cadurseg_Programacion_II_Clases
e!
PROGRAMACION
DE
COMPUTADORES
2024-1
II
Who is the teacher?
Karen Andrea Fonseca Estupiñan “PC2:-------”
• Classes
• Attributes
• Methods
• Constructors
• Overload of operators
• Polymorphism
• Import Create modules
What topics?
3. Applications
• Array programming
• Numpy
• ML basics with classes
• Deep Learning introduction
Scores
1. First exam 25%
5. Project 25%
Note
The exams will consist of two sections, verbal and written.
Question
s?
https://www.w3schools.com/python/
default.asp
Variables, types and
conversions x = "Hello World"
x = 20
str
int
x = 20.5 float
x = 1j complex
x = ["apple", "banana", "cherry"] list
x = True bool
x = b"Hello" bytes
x = bytearray(5) bytearray
x = memoryview(bytes(5)) memoryview
x = None NoneType
Variables, types and
conversions x = str("Hello World")
x = int(20)
str
int
x = float(20.5) float
x = complex(1j) complex
x = list(("apple", "banana", "cherry")) list
x = bool(5) bool
x = bytes(5) bytes
x = bytearray(5) bytearray
x = memoryview(bytes(5)) memoryview
Variables, types and
conversions
Code Result
\\ Backslash
\n New Line
Escape Characters \r Carriage Return
\t Tab
\b Backspace
\f Form Feed
() Parentheses
** Exponentiation
+x -x ~x Unary plus, unary minus, and bitwise NOT
* / // % Multiplication, division, floor division, and
modulus
extend() Add the elements of a list (or any iterable), to the end of the
current list
index() Returns the index of the first element with the specified
value
insert() Adds an element at the specified position
pop() Removes the element at the specified position
remove() Removes the item with the specified value
reverse() Reverses the order of the list
sort() Sorts the list
Tuple Methods
Method Description
count() Returns the number of times a specified value occurs in a tuple
index() Searches the tuple for a specified value and returns the position of where it
was found
Set Methods
Method Description
add() Adds an element to the set
clear() Removes all the elements from the set
copy() Returns a copy of the set
difference() Returns a set containing the difference between two or more sets
difference_update() Removes the items in this set that are also included in another, specified set