Try It Yourself

Problem 1: Check Data Types

Read your friend’s name, age, and height in feet, then display their data types.

Show Code
# Solution Example:
name = input("Enter your friend's name: ")
age = int(input("Enter their age: "))
height = float(input("Enter their height in feet: "))
print(type(name), type(age), type(height))

Problem 2: Identify Data Types in a List

Create a program that takes a list of mixed data types as input and displays the type of each element in the list.

Show Code
# Solution Example:
data_list = [123, "Python", 45.67, True, None, [1, 2, 3], {"key": "value"}]
 
print(f"Element: {data_list[0]} - Type: {type(data_list[0])}")
print(f"Element: {data_list[1]} - Type: {type(data_list[1])}")
print(f"Element: {data_list[2]} - Type: {type(data_list[2])}")
print(f"Element: {data_list[3]} - Type: {type(data_list[3])}")
print(f"Element: {data_list[4]} - Type: {type(data_list[4])}")
print(f"Element: {data_list[5]} - Type: {type(data_list[5])}")
print(f"Element: {data_list[6]} - Type: {type(data_list[6])}")