Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
How to Define a Type | Getting Familiar With Numbers in Python
Data Types in Python
course content

Course Content

Data Types in Python

Data Types in Python

1. Getting Familiar With Numbers in Python
2. True or False?
3. Strings
4. Bring All the Topics Together

bookHow to Define a Type

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy

Task

  1. Check the type of the number1 variable.
  2. Check the type of the number2 variable.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 7
toggle bottom row

bookHow to Define a Type

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy

Task

  1. Check the type of the number1 variable.
  2. Check the type of the number2 variable.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 7
toggle bottom row

bookHow to Define a Type

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy

Task

  1. Check the type of the number1 variable.
  2. Check the type of the number2 variable.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy

Task

  1. Check the type of the number1 variable.
  2. Check the type of the number2 variable.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 7
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt