



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




name = "Python" age = 20 marks = 85. passed = True
Arithmetic operators
Comparison operators
Logical operators
Assignment operators
Membership and identity
4. Conditional Statements
if statement
Example
marks = 75 if marks >= 40: print("Pass")
if-elif-else
Example
if marks >= 90: grade = "A" elif marks >= 75: grade = "B" else: grade = "C"
5. Loops
for loop
while loop
Example
for i in range(1, 6): print(i)
Loop control
import math print(math.sqrt(25))
Package
10. File Handling
Basic steps
Modes
Example
with open("notes.txt", "r") as f: data = f.read() print(data)
11. Exception Handling
Definition
Keywords
Example
try: x = 10 / 0 except ZeroDivisionError: print("Cannot divide by zero")
12. Object-Oriented Programming
Class and object
Main concepts
Example
class Student: def init(self, name): self.name = name
def display(self): print(self.name)
s = Student("Ravi") s.display()
13. Important Exam Questions
Short-answer questions
Long-answer questions
14. Quick Revision
Remember
Note: These are original study notes prepared for educational use. You can customize the title, add your college syllabus
topics, and include your own examples before uploading.