Python Assignment - Data Types
Question 1
Create variables for name, age, height, and is_student. Print the data type of each variable using
type().
Question 2
Ask the user to enter their name and age, then print a sentence using both values. Store age as an
integer.
Question 3
Create x = 15, y = 4.5, z = 'Python'. Print the value and data type of each variable.
Question 4
Convert num='25' to int and price=19.99 to int. Print the results and their data types.
Question 5
Store a string, integer, float, and boolean. Print each value and its data type.
Question 6
Create variables country, population, temperature, and is_summer. Print their values and data
types.
Question 7
Use type() to determine the data types of: '100', 100, 100.0, and False.
Question 8
Convert age='18' to int and height='170.5' to float. Print the new values and types.
Question 9
Create first_name, last_name, and age variables. Print: My name is ... and I am ... years old.
Question 10
Ask the user for their favorite color and favorite number. Print both values and their data types.
Question 11
Predict and verify the output of type(x) and type(y) where x=10 and y='10'.
Question 12
Convert price=50 to float and string. Print the value and type after each conversion.
Question 13
Store information about a book: title, pages, rating, available. Print all values and types.
Question 14
Find and correct the errors in a program that uses age='20', height=1.75, and student=true.
Question 15
Create a student profile using Name, Age, Grade, and Is_Graduated, then print the profile.
Challenge Question
Ask the user for Name, Age, and Weight. Store each using the correct data type and print the value
with its type.