Module - 1 Python
Module - 1 Python
PYTHON
MLO:
IWBAT-
Define keywords in programming languages and recognize their significance in syntax.
Identify common keywords such as if, else, for, while, and return.
Understand the role of keywords in defining the structure and behavior of code blocks.
Explain the concept of variables as placeholders for storing data in a program.
Declare and initialize variables of different data types (e.g., integer, string, boolean).
Utilize variables to store, manipulate, and retrieve information within a program.
Define identifiers as names given to variables, functions, or other elements in code.
Follow naming conventions for identifiers to ensure clarity and consistency in code readability.
Differentiate between valid and invalid identifiers based on language rules and best practices.
KEYWORDS
Variables
Values
Indentation
Reserved words/keywords
Statement
Expression
ACTIVITY-1
1 Create flashcards with Python keywords on one side and definitions on the other.
Ask students to match the keyword with its definition.
Review correct answers as a group
DEFINITIONS
A- A logical operator performing logical AND operation.
B.assert: Used for debugging purposes to assert that a certain condition is true.
C: Declares an asynchronous function or context manager.
E.: Terminates the loop statement and transfers execution to the statement immediately
following the loop.
F. Declares a class.
G. Skips the rest of the current iteration of a loop and continues with the next iteration.
H: Defines a function.
I.: Deletes an object or a variable.
J.: Short for "else if", used in conditional statements.
K: Executes a block of code when the preceding condition is false.
L.: Catches exceptions in try-except blocks.
M- Executes a block of code regardless of whether an exception was raised or not.
N: Iterates over items in a sequence.
O. Used to import specific attributes or submodules from a module.
P. Declares a global variable inside a function.
Q. Executes a block of code if a specified condition is true.
R.import: Imports modules into the current namespace.
S. Checks if a value exists in a sequence.
T.Checks if two variables refer to the same object.
U.Creates an anonymous function.
V. A logical operator performing logical NOT operation.
W.A logical operator performing logical OR operation.
X. Used as a placeholder where no action is required.
Y. Used to raise exceptions.
Z. Exits a function and optionally provides a return value.
AA.Starts a block of code that will be tested for errors.
AB Creates a loop that executes a block of code as long as a specified condition is true.
Text book exercises
1. 3.11
2. Guido Rossum
3. IDE
4. Indentation
5. sys.version
Text book exercises
True or False:-
1. True(1)
2. False(0)
3. True(1)
4. True(1)
5. False(0)
Answer the following:-
Ans. Python can run on a variety of hardware platforms, and has the same interface on all
platforms. Therefore Python is said to be portable.
+ add
- subtract
* multiply
/ divide
** exponent
// floor division
6. What are %s and %d?
1. C
2. C
3. C
4. A
5. D