Class 11 Computer Science Project File
📄 Page 1
1. Introduction to Python
Python is a high-level, general-purpose programming language introduced by Guido van Rossum in
1991. It focuses on code readability, using indentation instead of braces.
📌 Why Python? (As per Class 11 – Sumita Arora)
• Easy-to-read and simple syntax
• Portable and platform-independent
• Supports multiple programming paradigms (procedural, object-oriented)
• Large standard library
• Interactive and dynamic
📘 Applications of Python
• Software development
• Data analysis
• Artificial Intelligence
• Web applications
• Automation & scripting
📌 Features of Python (Table)
Feature Description
Simple Syntax Uses natural language-like structure
Interpreted Executes line-by-line
Portable Works on multiple operating systems
Extensible Can use C/C++ modules
Large Libraries Includes modules for math, OS, file handling
📄 Page 2
2. Python Fundamentals
Python fundamentals form the basic building blocks of programming.
1
📌 Identifiers
Names given to variables, functions, classes, etc. - Must begin with a letter or underscore - Cannot use
keywords - Case-sensitive
📌 Keywords (Class 11 List)
and, as, assert, break, class, continue, def, del, elif, else, except, finally,
for, from, global, if, import, in, is, lambda, not, or, pass, raise, return, try,
while, with, yield
📌 Variables
Used to store values. Python does not require explicit declaration.
x = 10
name = "Riya"
📌 Data Types (As per textbook)
• Numeric (int, float)
• Boolean (True/False)
• Sequence types (str, list, tuple)
• Mapping types (dict)
📘 Operators
Type Operators Example
Arithmetic + - * / % // ** a+b
Relational > < >= <= != == x>y
Logical and, or, not a and b
Assignment = += -= *= /= x += 2
📄 Page 3
3. Data Handling
Data handling includes input, processing, and output of data in Python.
📌 Input in Python
input() is used to accept data from the user.
2
name = input("Enter your name: ")
📌 Output in Python
print() displays output to the screen.
print("Hello", name)
📌 Type Conversion (Class 11 relevant)
Function Converts To
int() Integer
float() Decimal number
str() String
📘 Expressions & Comments
• Expression: Combination of values, variables, and operators
• Comments: # This is a comment
📄 Page 4
4. String
A string is a sequence of characters enclosed in quotes. Example:
s = "ComputerScience"
📌 Properties of Strings
• Immutable
• Indexed
• Ordered sequence
📌 String Operations (Class 11 Focus)
Operation Example Meaning
Indexing s[0] First character
Slicing s[2:6] Extract substring
3
Operation Example Meaning
Length len(s) Count characters
Concatenation s1 + s2 Joining strings
Repetition s*3 Repeat string
Examples
name = "Python"
print(name[1:4])
print(len(name))
📄 Page 5
5. List
A list is a mutable, ordered collection used to store multiple items.
📌 Characteristics
• Mutable
• Allows duplicates
• Can store mixed data types
• Supports indexing and slicing
• Dynamic (size can grow or shrink)
📌 Built-in List Functions (Textbook relevant)
Function Purpose
append() Adds item at end
insert() Inserts at a position
remove() Removes first occurrence
pop() Removes element by index
sort() Sorts the list
reverse() Reverses list
count() Counts occurrences
index() Returns index of value
4
📘 List Operations
• Concatenation: l1 + l2
• Repetition: l * 3
• Membership: in , not in
• Slicing: l[1:4]
Examples
marks = [90, 85, 78]
[Link](92)
print(marks)
nums = [4, 2, 9, 1]
[Link]()
print(nums)
📘 Practical Use (Class 11 Level)
Lists are used to store: - Student marks - Names of employees - Shopping items
A list is a mutable, ordered collection used to store multiple items.
📌 Characteristics
• Mutable
• Allows duplicates
• Can store mixed data types
• Supports indexing and slicing
📌 Built-in List Functions (Textbook relevant)
Function Purpose
append() Adds item at end
insert() Inserts at a position
remove() Removes first occurrence
pop() Removes element by index
sort() Sorts the list
reverse() Reverses list
5
Example
marks = [90, 85, 78]
[Link](92)
print(marks)
📄 Page 6
6. Tuple
A tuple is an ordered, immutable collection.
📌 Features
• Immutable
• Faster than lists
• Can contain mixed data types
• Supports indexing and slicing
• Safe for fixed data
📌 Why Tuples? (Textbook)
Used when data should not change, such as: - Coordinates - Days of the week - Student roll numbers
Tuple Functions
Function Purpose
count() Counts occurrences
index() Finds index
Tuple Packing & Unpacking
# Packing
t = 10, 20, 30
# Unpacking
a, b, c = t
print(a, b, c)
Tuple vs List
List Tuple
Mutable Immutable
6
List Tuple
Slower Faster
Uses [] Uses ()
Suitable for changing data Suitable for fixed data
A tuple is an ordered, immutable collection.
📌 Features
• Immutable
• Faster than lists
• Can contain mixed data types
📌 Why Tuples? (Textbook)
Used when data should not change, such as coordinates.
Example
point = (3, 4)
print(point[0])
📄 Page 7
7. Dictionary
A dictionary stores data in key–value pairs.
📌 Characteristics
• Mutable
• Keys must be unique
• Values can be duplicated
• Fast access using keys
• Unordered (but insertion order preserved in Python 3.7+)
📌 Dictionary Methods (Class 11 Relevant)
Method Description
keys() Returns all keys
values() Returns all values
7
Method Description
items() Returns key–value pairs
update() Updates dictionary
pop() Removes key
get() Returns value safely
Adding & Modifying Data
student = {"name": "Riya", "age": 16}
student["grade"] = "A" # Add
student["age"] = 17 # Modify
Traversing a Dictionary
for key, value in [Link]():
print(key, value)
Common Uses
• Storing student records
• Contact lists
• Product prices
• Employee database
✔ More relevant content added successfully!