Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4
Grade 7 Python Programming Worksheet
Name: ________________________
Multiple Choice Questions (MCQs)
1. Which of the following is NOT a basic data type in Python? A) Integer B) String C) Float D) Character 2. What will the following code output? print(type(3.14)) A) <class 'int'> B) <class 'str'> C) <class 'float'> D) <class 'list'>
Short Answer Questions
4. List three different data types in Python and give a brief description of each.
5. What is the purpose of the input() function in Python?
Long Answer Questions
6. Write a short Python program that takes user input for two numbers and outputs their sum. Include comments to explain each part of the code. 7. Explain how variables are used in Python to perform calculations. Provide an example of a program that uses at least two variables and one arithmetic operator.
Fill in the Blanks (Word Bank)
Word Bank: (integer, float, string, variable, operator) 8. A ____________ is used to store data that can be changed during program execution.
9. The data type ____________ is used to represent decimal numbers in Python.
10.In Python, a ____________ is a symbol that tells the interpreter to perform a
specific mathematical operation. Answer Key Multiple Choice Questions (MCQs) 1. D) Character Characters are not a distinct data type in Python; they are treated as strings of length one. 2. C) <class 'float'> The output indicates that 3.14 is classified as a float.
Short Answer Questions
4. List three different data types in Python and give a brief description of each. Integer: A whole number, positive or negative, without decimals (e.g., 5, -3). Float: A number that includes a decimal point (e.g., 3.14, -0.001). String: A sequence of characters enclosed in quotes (e.g., "Hello", "123"). 5. What is the purpose of the input() function in Python? The input() function is used to take user input as a string. It allows the program to receive data from the user during execution.
Long Answer Questions
6. Write a short Python program that takes user input for two numbers and outputs their sum. Include comments to explain each part of the code. 7. Explain how variables are used in Python to perform calculations. Provide an example of a program that uses at least two variables and one arithmetic operator. Variables in Python are used to store data that can be manipulated. For example, you can use variables to store numbers and then perform calculations using arithmetic operators. # Output the result
Fill in the Blanks (Word Bank)
8. Variable A variable is used to store data that can be changed during program execution. 9. Float The data type float is used to represent decimal numbers in Python. 10.Operator In Python, an operator is a symbol that tells the interpreter to perform a specific mathematical operation.