Practice Try It Yourself - 1.8 | 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

Try It Yourself

1.8 - Try It Yourself

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 '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.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

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.

2 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

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.

Challenge 2 Hard

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.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.