Page 127 - TP_V5.1_C7_fb
P. 127
6. Nitara believes entertainment apps like YouTube and Netflix should only be used in free time,
but Shanaya argues with her that they can be educational too. What are your thoughts on using
entertainment apps for learning?
Chapter 7: Tokens and Data Types in Python
1. Raman is writing a program to input and display student names and weights, which data type
should he use for weight, and why?
2. Savina wants to write a program to check if a number is even or odd, which operator can help
her find the remainder? Write a short Python code snippet to demonstrate how she can use this
operator.
3. Pihu wants to use an identifier in Python that starts with a digit, what will happen, if she does this?
Write a Python code to show what happens when such an identifier is used.
4. Arjun is on a treasure hunt and receives clues in various data types:
• A float for the distance to the treasure.
• A list of locations he must visit.
• A boolean for whether the treasure is above ground or not. Write a Python program that stores
these values and prints each clue.
5. Analyze the following code snippet and identify which elements are invalid identifiers. Explain why
they are invalid and correct them:
1variable = 10
my_variable@ = 20
my-variable = 30
6. Consider the following Python code snippet:
a = 5
b = 2
c = 8
print((a * b ** 2) > 10 and (c // a) <= 2)
a. Evaluate the expression inside the print statement step-by-step.
b. Explain each calculation and the result of the expression.
Chapter 8: Control Structures in Python
1. Priya is trying to create a program that will check if a number is positive. Guide her write the
program that will print Positive number if the value of the number is greater than zero.
2. Tara is developing a small grading system. If a student’s marks are above 80, it should
print Excellent, between 60 and 80 should print Good, and less than 60 should print Needs
Improvement. Can you write the code for this using if-elif-else?
3. You are developing a traffic light program. If the signal is red, the program should print Stop.
If the signal is yellow, it should print Wait, and if it is green, it should print Go. How would you
implement this using a control structure in Python?
Assignments 125

