Chapter 5: Getting Started with Python
• Python is a high-level, interpreted, and easy-to-learn programming language.
• Python can be run in IDLE, Jupyter Notebook, Spyder, or Command Line.
• print() is used to display output.
Example Code:
print('Hello, World!')
Chapter 6: Python Fundamentals
• Tokens: Keywords, Identifiers, Literals, Operators, Punctuators.
• Variables store data and do not need type declaration.
• Python follows dynamic typing.
Example Code:
a = 10
b=5
print(a + b)
Chapter 7: Data Handling
• Data types: int, float, string, list, tuple, set, dictionary.
• Mutable: list, set, dictionary. Immutable: int, float, tuple, string.
Example Code:
my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Chapter 8: Python Modules
• Modules are files containing Python code.
• Common modules: math, random, statistics.
Example Code:
import math
print([Link](16))
Chapter 9: Flow of Control
• if, if-else, if-elif control decision making.
• Loops: for, while.
• break and continue control loop flow.
Example Code:
for i in range(1,6):
print(i)
Chapter 10: String Manipulation
• Strings are immutable.
• String slicing and built-in functions are used.
Example Code:
s = 'Python'
print(s[0:3])
Chapter 11: List Manipulation
• Lists are ordered and mutable.
• Methods: append(), insert(), remove(), sort().
Example Code:
lst = [3,1,2]
[Link]()
print(lst)
Chapter 12: Tuples
• Tuples are ordered but immutable.
• Used for fixed data.
Example Code:
t = (1,2,3)
print(t[1])
Chapter 13: Dictionaries
• Stores data in key-value pairs.
• Keys are unique.
Example Code:
d = {'a':1, 'b':2}
print(d['a'])
Chapter 14: Cyber Safety
• Safe browsing, strong passwords, and privacy protection are essential.
• Cyber crimes include hacking, phishing, and cyber bullying.
Chapter 15: Society, Law and Ethics
• Ethics guide responsible technology use.
• Open-source software promotes collaboration.
• E-waste management is important for environment.