1.5 - Checking the Type of a Variable
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Create a variable fruit and assign it the value 'Mango'. What is its type?
💡 Hint: Use the type() function to find out.
What will print(type(3.14)) output?
💡 Hint: Think about the number type.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the type() function do?
💡 Hint: Think about what information you get from a variable.
True or False: The data type of a variable cannot change in Python.
💡 Hint: Remember dynamic typing!
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a program that asks for a user's name, age, and height. Display the types of all inputs and convert the age to a string and back to an integer.
💡 Hint: Look at how the input function works.
Create a function that takes a string representation of a number and returns its integer value. Use type() to confirm its type.
💡 Hint: Dwell on the conversion process in your function.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.