🪄 Generate Content
🎓 9th Grade 📚 9th Grade Other

📄 9th Grade Other: Python Coding Worksheet Worksheet

📌 1. True / False

1. In Python, the print() function is used to display output on the console.

2. A variable in Python can only store whole numbers (integers).

3. Comments in Python begin with the // symbol.

4. The input() function in Python is used to get data from the user.

5. String values in Python must be enclosed in single quotes or double quotes.

✏️ 2. Fill in the Blanks

1. A is a named storage location in a computer's memory that holds a value.
2. The function is used to display text or variable values to the user.
3. Data that consists of a sequence of characters, like 'Hello World', is called a .
4. To convert a user's input to a whole number, you can use the () function.
5. The () function pauses the program and waits for the user to type something and press Enter.

🔗 3. Matching

« A name that refers to a value stored in memory.
« A sequence of characters, such as letters, numbers, or symbols, enclosed in quotes.
« A whole number (positive, negative, or zero) without any decimal part.
« Outputs information to the console for the user to see.
« Allows a program to receive data from the user during execution.

✍️ 4. Short Answer Questions

1. What is the primary purpose of using comments in Python code?

2. Write a single line of Python code that assigns the string 'Python is fun!' to a variable named message.

🎯 5. Multiple Choice

1. What will be the output of the following Python code snippet?\n\nprint('Hello' + ' ' + 'World')

2. Which of the following is a valid variable name in Python?

3. What data type would Python assign to the value 3.14?

📝 6. Open-Ended Questions

1. Write a Python program that asks the user for their favorite color and then prints a message incorporating that color. For example, if the user enters 'blue', the program should print 'Your favorite color is blue. That's a great choice!'

2. Identify and correct the error in the following Python code snippet so that it prints 'My age is 15'. Explain what the original error was.

age = 15
print("My age is " + age)

3. Explain the difference between a string and an integer data type in Python, and provide an example for each.