Python Worksheet for Class XI
Section A: Basics of Python
Variables and Data Types
- A variable in Python is used to store ___________.
- The data type used to store decimal numbers in Python is called ___________.
- The function used to find the type of a variable in Python is ___________.
# Example: x = 10 y = 3.14 z = "Hello" # Fill in the blanks: a) The data type of `x` is ___________. b) The data type of `y` is ___________. c) The data type of `z` is ___________.
Basic Operations
- The symbol used for addition in Python is ___________.
- To divide two numbers and get an integer result, use ___________ operator.
- The operation
7 % 2
will return ___________.
# Example: a = 10 b = 3 # Fill in the blanks: a) The result of `a + b` is ___________. b) The result of `a // b` is ___________. c) The result of `a % b` is ___________.
Section B: Control Structures
Conditional Statements
- The keyword used for making decisions in Python is ___________.
- The block of code under an
if
statement is indented by ___________ spaces by default. - The ___________ keyword is used to provide an alternative condition in an
if-else
structure.
# Example: num = 10 if num > 0: print("Positive number") else: print("Negative number") # Fill in the blanks: a) If `num = -5`, the output will be ___________. b) The keyword to check multiple conditions is ___________. c) The output if `num = 0` and the code is `if num > 0: print("Positive") elif num == 0: print("Zero") else: print("Negative")` will be ___________.
0 Comments
Please do note create link post in comment section