1.10 - Exercise
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
Declare a variable color and assign it a favorite color.
💡 Hint: Use the format variable_name = value.
What type of data does age = 30 hold?
💡 Hint: Think about whether it's whole or decimal.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the purpose of the type() function?
💡 Hint: Think about what you would want to check about a variable.
True or False: Variable names can start with a number.
💡 Hint: Recall the naming rules for variables.
Get performance evaluation
Challenge Problems
Push your limits with advanced challenges
You have data collected from a survey where ages are accidentally stored as strings. Write a function that takes a list of ages as strings and returns a new list with the ages converted to integers.
💡 Hint: Consider using list comprehension for efficient conversion.
Create a Python program that takes input for two users' names and favorite numbers. Swap the values, then print out the new values along with their types.
💡 Hint: Don’t forget to capture inputs as strings and then convert them as necessary.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.