Create Variables of Each Type
Beginner · Write the code · from Python Variables and Data Types: A Practical Introduction
From the lesson: Python Variables and Data Types: A Practical Introduction
Imagine you're shipping a package. You fill out a label that asks for the weight. You write "heavy" instead of a number. The shipping system crashes - it can't calculate a price from the word "heavy."
Read the lessonCreate one variable of each core Python type and print its type. Your output should be exactly:
<class 'int'>
<class 'float'>
<class 'str'>
<class 'bool'>
<class 'NoneType'>You can name the variables anything you like and give them any value - as long as the types match.
# Create one variable of each type
# Print the type of each variable
More Variables and Data Types exercises
- Temperature ConverterBeginner
- Predict the Output: Truthy or Falsy?Beginner
- Fix the Bug: String + Number CrashBeginner
- Swap Two VariablesBeginner
- Type Conversion ChainBeginner
All Python exercises · 50 practice problems · Python Fundamentals quiz