Practice Questions on -Python Variables & Data Types Part -1
- Anubhav Somani
- Sep 1
- 2 min read

Here is a new set of Python questions focusing specifically on variables and data types.
1. User Greeter (Strings)
Create two variables, first_name and last_name. Assign them a name (e.g., "Ada", "Lovelace"). Create a third variable, greeting, that uses an f-string to combine them into a welcome message like "Hello, Ada Lovelace!". Finally, print the greeting.
2. Circle Area Calculator (Integers & Floats)
Define a variable radius and set it to an integer value (e.g., 5). Calculate the area of the circle (Area = π * r²) and store it in a variable called area. Use 3.14159 for π. Print the result in a user-friendly format, like "The area of a circle with radius 5 is: 78.53975".
3. To-Do List Manipulation (Lists)
Create a list called todo_list with three string items: "Read a book", "Write some code", "Go for a walk".
Print the second item in the list.
Change the first item to "Read a Python book".
Add a new item, "Call a friend", to the end of the list.
Finally, print the entire modified list.
4. User Profile (Dictionaries)
Create a dictionary named user_profile. It should contain the following key-value pairs:
username: "coder_dev"
email: "coder@example.com"
age: 28
is_active: True
Print the user's email and their age from the dictionary using the keys.
5. Data Type Checker (Booleans & Type Function)
Write a function check_and_print_type that takes one variable as an argument. Inside the function, use the type()function to find out the data type of the variable and print it to the console in a sentence like "The data type is <class 'str'>". Test your function by calling it with a string, an integer, a list, and a boolean value.

Comments