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

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Practice Questions

Test your understanding with targeted questions related to the topic.

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.

Practice 4 more questions and get performance evaluation

Interactive Quizzes

Engage in quick quizzes to reinforce what you've learned and check your comprehension.

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.

Solve and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

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.

Question 2

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.

Challenge and get performance evaluation