MODULE -1 Introduction to python -notes-grade 8).pptx

SUMYVINOD 235 views 15 slides Jul 13, 2024
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

Notes of Module 1 -python of grade 8. It Short answer, fill up and multiple choice questions answer


Slide Content

MODULE -1 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 Fill in the blanks:- 3.11 Guido Rossum IDE Indentation sys.version

Text book exercises True or False:- True(1) False(0) True(1) True(1) False(0)

Answer the following:- What are the features of Python? Easy to learn-simple structure and syntax Readable- code blocks are identified by indentation Standard library- contains libraries that are portable and cross platform compatible. Interactive Mode-allows interactive testing and debugging Database support- provides interface to all the major commercial databases.

2. Why is Python said to be portable? 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. 3. What are the rules for naming variables in Python? Ans. Must start with a letter or underscore(_) Must consist of letters, numbers and underscores. It’s case sensitive. Reserved words cannot be used. 4. Name five reserved keywords in Python. and, del, for, in, try

5. Write the function of the arithmetic operators in Python. add subtract * multiply / divide ** exponent // floor division

6. What are %s and %d? %s is used as a placeholder for string values. %d is used as a placeholders for integer values. %f is used as a placeholders for decimal values

Practical:- Execute the following expressions in python and write the output.

Match the following:- Interpreter- execute program x=0 - statement **- exponent Variable- value IDLE- Editor

MCQ C C C A D