Practice Try It Yourself - 1.8 | 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 'fruit' and assign it the value 'Mango'. What will be the output of print(fruit)?

💡 Hint: Just use the variable name you assigned.

Question 2

Easy

Create an integer variable 'quantity' and a float variable 'price'. Assign them values and print them. What types do you expect?

💡 Hint: Remember what you learned about data types.

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 result of type('Hello')?

  • <class 'int'>
  • <class 'str'>
  • <class 'float'>

💡 Hint: Think about what type of data 'Hello' represents.

Question 2

True or False: Variables can start with a number.

  • True
  • False

💡 Hint: Recall the rules we discussed about naming variables.

Solve 2 more questions and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Design a small program that calculates the area of a rectangle. The user inputs the length and width as floats. Store them in variables. Convert them as necessary to perform calculations, and then print the area.

💡 Hint: Remember to ask for input and convert to float before calculating.

Question 2

Create a variable to represent your age as a string, convert it to an int, and determine what year you were born in if the current year is 2023.

💡 Hint: Think about how to extract the year from the current year minus your age.

Challenge and get performance evaluation