Page 128 - 2403_Trackpad_V5.1_C6_Fb
P. 128
3. What is the data type of the following variable assignments?
var1 = 45
var2 = 3.14
var3 = “Hello, World!”
var4 = True
var1 is of type __________
var2 is of type __________
var3 is of type __________
var4 is of type __________
4. What will be the output of the following code snippet?
number_str = “10”
number_int = int(number_str)
result = number_int + 5
print(“The result is:”, result)
5. You want to create a simple expense tracker program. Write a Python program that:
• Asks the user to enter their expenses for the month (e.g., Rent, Groceries, Utilities).
• Calculates the total expenses.
6. Imagine you are creating a simple age calculator. Write a Python program that asks the user for
their birth year and then calculates and prints their age. Assume that the current year is 2024.
Explain how your program calculates age.
7. Given the following code snippet:
num_str = “25”
num_int = int(num_str)
num_float = float(num_str)
a. What will be the values of num_int and num_float after execution?
b. Explain why and how the int() and float() functions are used for type conversion.
Chapter 9: Introduction to Artificial Intelligence
1. Read the scenarios below and identify the type of intelligence being used:
• Anna can easily talk to new people and make friends.
• Sam loves to solve tricky puzzles and math problems.
• Lily can dance beautifully and play sports well.
• Tom writes amazing stories and poems.
Options: Interpersonal, Logical-Mathematical, Bodily-Kinesthetic, Linguistic.
2. Neha wants to count the number of steps she takes during her morning walk, as well as monitor
her heart rate. Which AI-enabled device can Neha use to track her steps and heart rate?
126 Premium Edition-VI

