0% found this document useful (0 votes)
5 views26 pages

Python Class11 StudyMaterial

This document is a quick revision and exam study material for Class 11 Python programming, covering chapters 2, 3, and 4. It includes key points, multiple choice questions, fill in the blanks, and true/false questions to aid students in their studies. The material is designed for different learning levels, providing strategies for weak, average, and good students.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views26 pages

Python Class11 StudyMaterial

This document is a quick revision and exam study material for Class 11 Python programming, covering chapters 2, 3, and 4. It includes key points, multiple choice questions, fill in the blanks, and true/false questions to aid students in their studies. The material is designed for different learning levels, providing strategies for weak, average, and good students.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON PROGRAMMING

Class 11 - Chapters 2, 3 & 4


Quick Revision & Exam Study Material
MCQs · Fill in the Blanks · True/False · One Word · Find the Output · Key Points

Prepared by:
Maninder Singh
Computer Faculty
School of Eminence Amloh, District Fatehgarh Sahib
Department of Education Punjab
Contact: 98555-33266

HOW TO USE THIS BOOKLET

FOR WEAK / SLOW LEARNERS:

★ Read only the KEY POINT lines - just 1 to 3 lines per topic.

★ Memorize those lines first. That is enough to attempt basic questions.

★ Then try Fill in the Blanks and MCQs.

FOR AVERAGE / GOOD STUDENTS:

★ Write the KEY POINT as your opening line in every answer.

★ Then expand with examples, syntax, or program code from the chapter.

★ Attempt ALL question types in this booklet.


CHAPTER 2 INTRODUCTION TO PYTHON

FULL FORMS

Short Form Full Form

IDLE Integrated Development and Learning Environment

IDE Integrated Development Environment

AI Artificial Intelligence

ML Machine Learning

ASCII American Standard Code for Information Interchange

KEY POINTS TO REMEMBER

★ Python: Python is a popular, general-purpose, high-level programming language developed by


Guido van Rossum and released in 1991. It is a dynamically typed language.

★ IDE: An IDE (Integrated Development Environment) is a software dedicated to software


development. IDLE is Python's default IDE.

★ Interpreter: An Interpreter is a program which translates code into machine language and
executes it line by line.

★ Interactive Mode: In Interactive Mode, Python interpreter executes each command


immediately after it is typed at the >>> prompt.

★ Script Mode: In Script Mode, a complete Python program is written in a file and executed by
pressing F5.
★ Token: Tokens are the smallest individual elements of a program. Types: Keywords,
Identifiers, Literals, Operators, Delimiters.

★ Keyword: Keywords are reserved words in Python. They have special meaning and cannot be
used as variable names.

★ Identifier: Identifiers are names given to program elements like variables, functions. They
cannot start with a digit and cannot be a keyword.

★ Literal: Literals are fixed/constant values used in a program. Types: String, Numeric (Integer,
Float, Complex), Boolean, Special (None).

★ Variable: A variable is a reserved memory location to store a value. In Python, a variable is


created the moment a value is assigned to it.

★ Comment: A comment is a text that gives explanation about the program code. Python uses #
for single-line and triple quotes for multi-line comments.

★ print(): print() function is used to display output on the screen. Syntax: print(objects, sep, end).

★ input(): input() function is used to take input from the keyboard. It always returns a string value.

MULTIPLE CHOICE QUESTIONS - Chapter 2

1. Python was developed by ___________ .

a) Bill Gates b) Guido van Rossum ✓

c) Dennis Ritchie d) James Gosling

2. IDLE stands for ___________ .

a) Integrated Direct Learning Env. b) Integrated Development and Learning Env. ✓

c) Information Development Learning Env. d) None of these

3. The shell prompt in Python IDLE is ___________ .

a) >> b) >>> ✓

c) << d) <<<
4. Which shortcut key is used to run a Python script file?

a) F1 b) F3

c) F5 ✓ d) F7

5. Tokens are the ___________ individual elements of a program.

a) Largest b) Smallest ✓

c) Most complex d) None of these

6. Which of the following is NOT a valid Python identifier?

a) rollno b) House_No

c) 92sector ✓ d) sector92

7. Keywords in Python are always written in ___________ letters.

a) Uppercase b) Lowercase ✓

c) Mixed d) Any case

8. Which function is used to display output in Python?

a) input() b) display()

c) show() d) print() ✓

9. The input() function always returns a ___________ .

a) Integer b) Float

c) String ✓ d) Boolean

10. Which of the following is a multi-line comment in Python?

a) // comment b) ## comment

c) """ comment """ ✓ d) /* comment */

11. An IDE is a software dedicated to ___________ .

a) Hardware development b) Software development ✓


c) Network design d) None of these

12. Python is a ___________ typed language.

a) Statically b) Dynamically ✓

c) Strongly d) Weakly

13. Which literal type has only True and False values?

a) String Literal b) Numeric Literal

c) Boolean Literal ✓ d) Special Literal

14. The sep keyword in print() is used to ___________ .

a) End the output b) Separate objects ✓

c) Skip a line d) None of these

15. Identifiers cannot start with a ___________ .

a) Letter b) Underscore

c) Digit ✓ d) None of these

FILL IN THE BLANKS - Chapter 2

1. Python was released in the year ___________ . Ans: (1991)

2. IDLE stands for ___________ . Ans: (Integrated Development and Learning Environment)

3. In Interactive Mode, the shell prompt is ___________ . Ans: (>>>)

4. ___________ are the smallest individual elements of a program. Ans: (Tokens)

5. ___________ are reserved words in Python that cannot be used as identifiers. Ans:
(Keywords)

6. The ___________ function is used to display output in Python. Ans: (print())

7. The ___________ function is used to take input from keyboard. Ans: (input())
8. The input() function always returns a ___________ value. Ans: (String)

9. A ___________ is a text that explains the program code and is ignored by the interpreter. Ans:
(Comment)

10. Variables are those identifiers which are used to ___________ values. Ans: (store)

11. Identifiers are names given to program elements like variables and ___________ . Ans:
(functions)

12. The shortcut key to run a Python script file is ___________ . Ans: (F5)

13. Python was developed by ___________ . Ans: (Guido van Rossum)

14. An Interpreter translates code into ___________ language and executes it line by line. Ans:
(machine)

15. The ___________ literal type uses True and False values only. Ans: (Boolean)

TRUE / FALSE - Chapter 2

1. Python is a low-level programming language. [ FALSE ]

2. IDLE is Python's default IDE. [ TRUE ]

3. Keywords can be used as variable names. [ FALSE ]

4. The input() function always returns a string. [ TRUE ]

5. Identifiers can start with a digit. [ FALSE ]

6. Comments are executed by the Python interpreter. [ FALSE ]

7. Python uses indentation to define blocks of code. [ TRUE ]

8. The # symbol is used for single-line comments in Python. [ TRUE ]


CHAPTER 3 DATA TYPES, OPERATORS &
EXPRESSIONS

FULL FORMS

Term Meaning / Full Form

int Integer - whole numbers (e.g. 10, -5, 0)

float Floating-point - numbers with decimal point (e.g. 3.14)

str String - sequence of characters

bool Boolean - True or False

NoneType Data type of the None value in Python

KEY POINTS TO REMEMBER

★ Data Type: A data type represents a kind of value and determines what operations can be
done on it. Python is a dynamically typed language.

★ type() function: The type() function returns the data type of a variable. Example: type(10)
returns <class 'int'>.

★ Numeric Types: Numeric data types hold numeric values. Python has three: Integer (int),
Floating Point (float), and Complex numbers.

★ Integer: Integers are whole numbers without fractions (e.g. 44, -56, 0). There is no limit to how
long an integer can be in Python.

★ Float: Floating numbers are real numbers with a decimal point (e.g. 3.14, -5.6). Maximum
value is approximately 1.8×10^308.

★ Complex: Complex numbers have real and imaginary parts written as A+Bj. Example: 2+3j.
★ Boolean: Boolean data type has only two values: True and False. It represents the truth value
of an expression.

★ Sequence Types: A sequence is an ordered collection of data items. Types: List, Tuple,
Range, String.

★ List: A List is an ordered, mutable (changeable) collection written in square brackets [ ].


Example: [12, 5.6, 'Hello'].

★ Tuple: A Tuple is an ordered, immutable (write-protected) collection written in parentheses ( ).


Example: (12, 5.6, 'Hello').

★ Set: A Set is an unordered collection of unique elements written in curly braces { }. Duplicate
values are ignored.

★ Dictionary: A Dictionary stores data as key:value pairs written in curly braces. Example:
{'Name':'Raj', 'Age':15}.

★ None: None is a special data type representing the absence of value. It is not the same as 0,
False, or empty string.

★ Mutable Types: Mutable types can be changed after creation. Examples: List, Dictionary, Set.

★ Immutable Types: Immutable types cannot be changed after creation. Examples: Integer,
String, Tuple.

★ Operator: Operators are special symbols used to perform operations on operands. Example:
+, -, *, /.

★ Arithmetic Operators: Arithmetic operators: + (Add), - (Sub), * (Mul), / (Real Div), //


(Integer Div), % (Modulus), ** (Exponent).

★ Relational Operators: Relational operators compare values and return True or False: ==, !=,
>, <, >=, <=.

★ Logical Operators: Logical operators: and, or, not - return Boolean results based on
conditions.

★ Membership Operators: Membership operators: in, not in - check if a value exists in a


sequence.

★ Assignment Operator: = operator stores value in variable. Augmented operators: +=, -=, *=,
/=, //=, %=, **=.
★ Expression: An expression is a valid combination of operators and operands that returns a
single value after evaluation.

★ Operator Precedence: Order (High to Low): ( ) > ** > Unary +/- > *, /, //, % > +, - >
Comparisons > Logical (not, and, or).

★ Implicit Conversion: Python automatically converts lower data type to higher (e.g. int to float)
to prevent data loss. Also called coercion.

★ Explicit Conversion: Programmer manually converts data type using functions: int(), float(),
str(), list(), tuple(), set(), complex().

ARITHMETIC OPERATORS - QUICK TABLE

Symbol Name Example Result

+ Addition 5 + 10 15

- Subtraction 5 - 10 -5

* Multiplication 5 * 10 50

/ Real Division 19 / 5 3.8

// Integer Division 19 // 5 4

% Modulus (Remainder) 19 % 5 4

** Exponent (Power) 5 ** 2 25
OPERATOR PRECEDENCE (Highest to Lowest)

Precedence Operator / Description

HIGHEST ( ) Parenthesis

↓ ** Exponentiation

↓ +x, -x Unary Plus and Minus

↓ *, /, //, % Multiply, Divide, Floor Division, Modulo

↓ +, - Addition and Subtraction

↓ <=, <, >, >= Comparison Operators

↓ ==, != Equality Operators

↓ =, +=, -=, *=, /= Assignment Operators

↓ in, not in Membership Operators

LOWEST not, or, and Logical Operators

MULTIPLE CHOICE QUESTIONS - Chapter 3

1. Which function returns the data type of a variable?

a) datatype() b) type() ✓

c) typeof() d) dtype()

2. Which is NOT a standard Numeric Data Type in Python?

a) Integer b) Floating

c) Boolean ✓ d) Complex

3. Which represents the Mapping Data Type in Python?

a) List b) Dictionary ✓

c) Tuple d) Set
4. Which keyword defines a null / no value in Python?

a) Nothing b) Null

c) Zero d) None ✓

5. For creating a list in Python, we write data items in ___________ .

a) Parenthesis b) Square brackets ✓

c) Curly brackets d) Angular brackets

6. A Set is an ___________ collection of elements.

a) Ordered b) Unordered ✓

c) Indexed d) None

7. Which type is Mutable in Python?

a) Integer b) String

c) Tuple d) List ✓

8. Which operator is used to get the remainder after division?

a) / b) //

c) % ✓ d) **

9. Result of 19 // 5 is ___________ .

a) 3.8 b) 4 ✓

c) 5 d) 3

10. Result of 5 ** 2 is ___________ .

a) 10 b) 7

c) 25 ✓ d) 52

11. Which operator is NOT an Arithmetic Operator in Python?

a) / b) //
c) ** d) ++ ✓

12. Boolean data type has only ___________ possible values.

a) One b) Two ✓

c) Three d) Many

13. Tuples are written in ___________ .

a) Square brackets b) Curly brackets

c) Parentheses ✓ d) Angular brackets

14. Explicit type conversion is also called ___________ .

a) Coercion b) Type Casting ✓

c) Implicit d) Auto

15. Implicit conversion converts ___________ type to higher type.

a) Higher b) Lower ✓

c) Same d) None

16. Which operator has the highest precedence?

a) + b) *

c) ** d) ( ) ✓

17. Membership operators in Python are ___________ .

a) and, or b) in, not in ✓

c) ==, != d) +=, -=

18. The expression 4 != 5 is ___________ .

a) False b) True ✓

c) None d) Error

19. Which functions are used for explicit type conversion?


a) int() b) float()

c) str() d) All of these ✓

20. range(1, 10, 2) generates the sequence ___________ .

a) 1,2,3,...,9 b) 1,3,5,7,9 ✓

c) 2,4,6,8 d) 1,3,5,7

FILL IN THE BLANKS - Chapter 3

1. A data type represents a kind of ___________ and determines what operations can be done on
it. Ans: (value)

2. Python is a ___________ typed language. Ans: (dynamically)

3. The ___________ function returns the data type of a variable. Ans: (type())

4. Integers are ___________ numbers without fractions. Ans: (whole)

5. Floating numbers are real numbers written with a ___________ . Ans: (decimal point)

6. Complex numbers in Python are written as ___________ . Ans: (A+Bj)

7. Boolean data type has only two values: ___________ and ___________ . Ans: (True)
(False)

8. A List is a ___________ type - it can be changed after creation. Ans: (Mutable)

9. A Tuple is an ___________ type - it cannot be changed after creation. Ans: (Immutable)

10. A Set does not allow ___________ values. Ans: (duplicate)

11. Dictionary stores data in ___________ pairs. Ans: (key : value)

12. None represents the ___________ of value. Ans: (absence)

13. The % operator gives the ___________ after division. Ans: (remainder)

14. The // operator is called ___________ Division. Ans: (Integer / Floor)

15. The ** operator is used for ___________ . Ans: (Exponent / Power)

16. ___________ type conversion is done automatically by Python. Ans: (Implicit)


17. ___________ type conversion is done manually by the programmer. Ans: (Explicit)

18. Parenthesis ( ) has the ___________ precedence among all operators. Ans: (highest)

19. Logical operators not, or, and have the ___________ precedence. Ans: (lowest)

20. An ___________ is a valid combination of operators and operands. Ans: (Expression)

TRUE / FALSE - Chapter 3

1. Python automatically identifies the data type of a variable. [ TRUE ]

2. Boolean data type has three possible values. [ FALSE ]

3. A Set allows duplicate values. [ FALSE ]

4. A List is immutable. [ FALSE ]

5. A Tuple is immutable. [ TRUE ]

6. Symbol % represents the Modulus Operator. [ TRUE ]

7. A Set is an ordered collection. [ FALSE ]

8. Relational operators return True or False after comparison. [ TRUE ]

9. None is the same as 0 in Python. [ FALSE ]

10. Parenthesis has the highest precedence in Python. [ TRUE ]


CHAPTER 4 CONTROL STATEMENTS

KEY POINTS TO REMEMBER

★ Indentation: Indentation refers to the leading whitespace (spaces/tabs) at the beginning of a


code line. Python uses indentation to define blocks of code for loops, functions, and classes.

★ Flow Control: Flow Control represents the order in which statements are executed in a
program. Three types: Sequential, Conditional, and Looping.

★ Sequential: Sequential Flow Control is the default execution where statements are executed
one after the other in order, line by line.

★ Conditional: Conditional (Branching) Flow Control executes statements based on a condition.


If condition is True one block runs; if False another block runs.

★ Looping: Looping (Iterative) Flow Control repeats execution of statements as long as a


condition remains True.

★ if statement: The if statement runs a block of code only when a given condition is True.
Syntax: if condition:

★ if-else statement: The if-else statement runs the if block when condition is True and the else
block when condition is False.

★ if-elif-else: The if-elif-else statement tests multiple conditions. elif means 'else if'. The first true
condition's block executes.

★ Nested if-else: Nested if-else is an if-else statement placed inside another if-else. Indentation
determines the nesting level.

★ while loop: The while loop is a Conditional Loop. It repeatedly executes a block of statements
as long as the condition remains True.

★ for loop: The for loop is a Counting Loop. It iterates over a range or sequence and executes
statements for each item.

★ range() function: range(start, stop, step) generates a sequence of numbers. The stop value is
NOT included. Default: start=0, step=1.
★ continue: The continue statement skips the current iteration and moves to the next iteration of
the loop.

★ break: The break statement exits (terminates) the loop immediately when a condition is
fulfilled.

★ pass: The pass statement is a null statement - nothing happens when it is executed. Used to
define syntactically empty blocks.

★ Nested Loop: A Nested Loop is a loop inside another loop. The inner loop completes all its
iterations for each single iteration of the outer loop.

★ Infinite Loop: An Infinite Loop is a loop whose condition never becomes False, so it runs
forever. Press Ctrl+C to stop it.

SYNTAX QUICK REFERENCE - Chapter 4

Statement Syntax

if if condition: (then) statements

if-else if condition: statements else: statements

if-elif-else if cond1: ... elif cond2: ... else: ...

while loop while condition: statements

for loop for variable in range / sequence: statements

continue Placed inside loop - skips current iteration, continues next

break Placed inside loop - exits the loop immediately

pass Placed inside loop or block - does nothing (null)

range() range(start, stop, step) - stop is NOT included


MULTIPLE CHOICE QUESTIONS - Chapter 4

1. Indentation in Python is used to define ___________ .

a) Variables b) Blocks of code ✓

c) Functions only d) Data types

2. Sequential Flow Control is also called ___________ .

a) Looping b) Branching

c) Default Flow Control ✓ d) None of these

3. Conditional Flow Control is also known as ___________ .

a) Iterative Statement b) Branching / Decision-Making ✓

c) Sequential d) Looping

4. Looping Statement is also known as ___________ .

a) Iterative Statement ✓ b) Conditional Statement

c) Sequential Statement d) All of these

5. Which symbol is mandatory after the if condition?

a) Semicolon ; b) Colon : ✓

c) Comma , d) Dot .

6. The elif keyword is short for ___________ .

a) else if ✓ b) else

c) end if d) None

7. The while loop is also called a ___________ loop.

a) Counting b) Conditional ✓

c) Iterative d) None

8. The for loop is also called a ___________ loop.


a) Counting ✓ b) Conditional

c) Infinite d) None

9. range(5) generates ___________ .

a) 1,2,3,4,5 b) 0,1,2,3,4 ✓

c) 0,1,2,3,4,5 d) 1,2,3,4

10. Which statement is used to skip the current iteration?

a) break b) pass

c) continue ✓ d) stop

11. Which statement exits the loop prematurely?

a) continue b) break ✓

c) pass d) stop

12. The pass statement is a ___________ statement.

a) Loop control b) Conditional

c) Null ✓ d) Break

13. A loop within another loop is called ___________ .

a) Infinite Loop b) Nested Loop ✓

c) for-while loop d) None

14. A loop that never ends is called ___________ .

a) Continuous loop b) Infinite loop ✓

c) Circular loop d) None

15. To stop an infinite loop, we press ___________ .

a) Ctrl+Z b) Ctrl+C ✓

c) Ctrl+X d) Ctrl+S
16. range(2, 17, 2) generates the sequence ___________ .

a) 2,4,6,...,16 ✓ b) 2,4,6,...,17

c) 2,4,6,...,18 d) 1,3,5,...,17

17. Which of the following loop will continue infinitely?

a) while 0: b) while 1: ✓

c) while :1: d) while False:

18. Nested if-else statement is an if-else inside another ___________ .

a) Loop b) Function

c) if-else ✓ d) None

19. In Python, blocks are defined by ___________ .

a) Curly braces b) Semicolons

c) Indentation ✓ d) Keywords

20. The break statement brings control ___________ of the loop.

a) Inside b) Outside ✓

c) To the middle d) None

FILL IN THE BLANKS - Chapter 4

1. Indentation refers to the leading ___________ at the beginning of a code line. Ans:
(whitespace / spaces and tabs)

2. There are ___________ types of flow control in Python. Ans: (three / 3)

3. Sequential Flow Control is the ___________ execution type. Ans: (default)

4. Conditional Flow Control is also called ___________ or Decision-Making Flow Control. Ans:
(Branching)

5. Looping Flow Control is also called ___________ Flow Control. Ans: (Iterative / Repetitive)
6. A ___________ after the if condition is mandatory in Python. Ans: (colon :)

7. elif is short for ___________ . Ans: (else if)

8. The ___________ loop checks the condition before executing the block. Ans: (while)

9. The ___________ loop iterates over a range or sequence. Ans: (for)

10. range(start, stop, step) does NOT include the ___________ value. Ans: (stop)

11. The ___________ statement skips the current loop iteration. Ans: (continue)

12. The ___________ statement exits the loop immediately. Ans: (break)

13. The ___________ statement is a null statement - it does nothing. Ans: (pass)

14. A loop inside another loop is called a ___________ loop. Ans: (nested)

15. A loop that never ends is called an ___________ loop. Ans: (infinite)

16. To exit an infinite loop, we press ___________ . Ans: (Ctrl+C)

17. range(3, 7) generates the sequence: ___________ . Ans: (3, 4, 5, 6)

18. range(10, 5, -1) generates the sequence: ___________ . Ans: (10, 9, 8, 7, 6)

TRUE / FALSE - Chapter 4

1. Python uses curly braces to define blocks of code. [ FALSE ]

2. Sequential Flow Control executes statements line by line. [ TRUE ]

3. A colon after the if condition is optional in Python. [ FALSE ]

4. The while loop is also known as a Conditional Loop. [ TRUE ]

5. The for loop is also known as a Counting Loop. [ TRUE ]

6. The continue statement exits the loop. [ FALSE ]

7. The break statement skips the current iteration. [ FALSE ]

8. range(1, 10) generates numbers 1 to 10. [ FALSE ]

9. A Nested loop is a loop inside another loop. [ TRUE ]


10. Ctrl+C is used to stop an infinite loop. [ TRUE ]

MATCH THE FOLLOWING - All Chapters

Set A - Terms and Statements

Column A Column B Answer

1. IDLE a. Null statement 1→d

2. type() b. Returns string always 2→e

3. pass c. Skips current iteration 3→a

4. break d. Python's default IDE 4→f

5. continue e. Returns data type of variable 5→c

6. input() f. Exits the loop immediately 6→b

Set B - Operators and Types

Column A (Operators) Column B (Type) Answer

1. +, -, *, /, //, %, ** a. Logical Operators 1→d

2. and, or, not b. Assignment Operators 2→a

3. =, +=, -=, *=, /= c. Membership Operators 3→b

4. in, not in d. Arithmetic Operators 4→c

5. >, >=, <, <=, ==, != e. Relational Operators 5→e


ONE WORD / ONE LINE ANSWERS - All Chapters

1. Name the creator of Python. → Guido van Rossum

2. Name Python's default IDE. → IDLE

3. Which symbol starts a single-line comment in Python? → # (hash)

4. Which function checks the data type of a variable? → type()

5. Which data type stores key : value pairs? → Dictionary

6. Name the two membership operators. → in, not in

7. Name the three logical operators. → and, or, not

8. What is the default step value in range() function? → 1

9. Which operator is used for Exponent / Power? → ** (double star)

10. What does the // operator do? → Integer (Floor) Division

11. Name the immutable sequence type. → Tuple

12. Name the mutable sequence type. → List

13. What is the data type of the None value? → NoneType

14. Which loop checks condition before each iteration? → while loop

15. Which statement exits a loop immediately? → break

16. Which statement skips the current iteration? → continue

17. Which statement does nothing (null statement)? → pass

18. What is a loop inside another loop called? → Nested Loop

19. What is an infinite loop? → A loop whose condition never becomes False

20. What is Implicit Type Conversion also called? → Coercion

FIND THE OUTPUT - Practice Questions


1. Code:
a = 3**2 + 10
b = 5*6
c = 7.0/8.0
print('Values:', a, b, c)

Output: Values: 19 30 0.875

2. Code:
x, y = 12, 6
x, y = y, x + 2
print(x, y)

Output: 6 14

3. Code:
print(4.00 / (1.0 + 3.0))

Output: 1.0

4. Code:
print(4.00 / 1.0 + 3.0)

Output: 7.0

5. Code:
i = 4
while(i >= 1):
print(i)
i = i - 1

Output: 4 3 2 1

6. Code:
for i in range(1, 5):
print(i)
Output: 1 2 3 4

7. Code:
s = [2, 4, 8, 10]
print(8 in s)

Output: True

8. Code:
print((10 != 9) and (20 >= 20))

Output: True

9. Code:
age = 18
if age >= 18:
print('Eligible to Vote')
else:
print('Not Eligible to Vote')

Output: Eligible to Vote

10. Code:
for i in range(1, 11):
if i%2 != 0:
continue
print(i, end=' ')

Output: 2 4 6 8 10
MASTER QUICK REVISION CARD - Memorize These Lines!

CHAPTER 2 - Introduction to Python

1. Python is a popular, high-level, dynamically typed language developed by Guido van


Rossum (1991).

2. IDLE = Integrated Development and Learning Environment - Python's default IDE.

3. Tokens = smallest elements: Keywords, Identifiers, Literals, Operators, Delimiters.

4. Keywords are reserved words; Identifiers are names for variables / functions.

5. print() displays output; input() takes keyboard input and always returns a string.

CHAPTER 3 - Data Types, Operators & Expressions

1. A data type determines the kind of value and what operations are possible. Python is
dynamically typed.

2. Numeric: int, float, complex. Boolean: True / False. Sequence: List, Tuple, String,
Range.

3. List = mutable [ ], Tuple = immutable ( ), Set = unordered { }, Dict = key:value { }.

4. Operators: Arithmetic (+,-,*,/,//,%,**), Relational (==,!=,>,<), Logical (and, or, not).

5. Operator Precedence: ( ) > ** > Unary > *,/,//,% > +,- > Comparisons > Logical.

CHAPTER 4 - Control Statements

1. Indentation defines code blocks in Python - spaces / tabs at start of code lines.

2. Three Flow Controls: Sequential (default), Conditional (if/elif/else), Looping (while/for).

3. while loop = Conditional loop; for loop = Counting loop.

4. continue = skip current iteration; break = exit loop; pass = do nothing (null).
5. range(start, stop, step) - stop value is NOT included; default start=0, step=1.

© Maninder Singh | 98555-33266 | School of


Eminence Amloh, District Fatehgarh Sahib |
Department of Education Punjab
Python Programming - Class 11 - Chapters 2, 3 & 4
- Study Material

You might also like