The document discusses the basic building blocks of Python including data types, variables, control flow statements, functions, classes and modules. It provides examples of how to use strings, integers, boolean values, lists, dictionaries, tuples in Python code. It also demonstrates the use of conditionals, loops, exceptions, functions, classes and importing modules.
5. -Used to store
Data Values
myName = “Menard”
print(myName)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
6. -To access each
Iterable.
numbers = [
1, 3.14, -25]
pi = numbers[1]
print(pi)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
7. -Takes data from
the user.
name = input(
“Enter name: ”)
print(‘Hi’, name)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
12. -Make loops using
Conditions/Booleans
num = 10
while num != 0:
print(num)
num -= 1
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
13. -Make loops using
Iteration
for x in range(9):
print(x)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
15. -Describe codes
-To communicate
with other devs.
# Prints the Sum
print(9 + 3.14)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
18. -Higher level of
Organizing codes.
-Also the Objects
class Calc:
def add(self, x, y):
return x + y
Calc().add(9, 5)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
19. -Inheriting codes
from one class to
Another class.
class Comp(Calc):
pass
Comp().add(9, 5)
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
20. -Valid Python Files.
-Can be imported
to another module
import os
print(os.getcwd())
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
21. -Collection of
Built-in modules
import re
from math import *
import shutil as sh
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan
22. -Modules built by
the Community.
import requests
from bs4 import *
import numpy as np
Menard Maranan
https://www.youtube.com/channel/UC28oX1455dR2OF72o1DU80w/
Menard Maranan