Practice Exercise - 1.10 | Variables and Data Types | Python Programming Language
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Exercise

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.

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Declare a variable color and assign it a favorite color.

💡 Hint: Use the format variable_name = value.

Question 2 Easy

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

Question 1

What is the purpose of the type() function?

To get the value of a variable
To check variable type
To combine variables

💡 Hint: Think about what you would want to check about a variable.

Question 2

True or False: Variable names can start with a number.

True
False

💡 Hint: Recall the naming rules for variables.

Get performance evaluation

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

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.

Challenge 2 Hard

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.