Python Data Type Practice Questions
Q1. Write a Python program to add two integers a = 5 and b = 10, then print their sum.
Q2. Write a Python program to multiply two float numbers x = 2.5 and y = 4.0.
Q3. Create a string variable name = "Alice" and print the first and last characters using
indexing.
Q4. Write a program to print the data type of variable value = 100.
Q5. Concatenate two strings s1 = "Hello" and s2 = "Echo" and print the full message.
Q6. Create a list of 3 numbers [10, 20, 30]. Print the second element in the list.
Q7. Assign a boolean value True to a variable status and print its value and type.
Q8. Take a string input "25" and convert it to an integer. Print the result after adding 5.
Q9. Write a program to find the length of a string text = "Python".
Q10. Convert the string "45" to a float and print the type of the variable after conversion.
Q11. Convert a float mark = 89.7 to an integer and print the result.
Q12. Create a list of fruits ["apple", "banana", "mango"]. Print the last fruit using
negative indexing.
Q13. Convert the string "78.9" to a float and print the result.
Q14. Add an integer a = 5 and a float b = 2.5, and print the result and its type.
Q15. Create a complex number z = 4 + 5j and print its value and type.