Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Converting: float() | Bring All the Topics Together
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

bookConverting: float()

Given that we have already acquired an understanding of the int() operation, it is unnecessary to reiterate the same information. The float() function serves a similar purpose, with the distinction of converting data into the floating-point data type.Look at this simple example:😁

1234567
variable1 = 56 variable2 = "98.7" variable3 = "5e4" print(float(variable1)) print(float(variable2)) print(float(variable3))
copy

It seems to me that one fascinating feature of the float() function should be noted. Not only can we represent regular numbers, but we can also represent concepts like infinity and Not a Number (NaN).

Task

You should take everything with a grain of salt! Try to check the output of the statements that are given in the task. They should be clear for Python too. Just output the code.

NaN - values that were not defined

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 4. Chapter 3
toggle bottom row

bookConverting: float()

Given that we have already acquired an understanding of the int() operation, it is unnecessary to reiterate the same information. The float() function serves a similar purpose, with the distinction of converting data into the floating-point data type.Look at this simple example:😁

1234567
variable1 = 56 variable2 = "98.7" variable3 = "5e4" print(float(variable1)) print(float(variable2)) print(float(variable3))
copy

It seems to me that one fascinating feature of the float() function should be noted. Not only can we represent regular numbers, but we can also represent concepts like infinity and Not a Number (NaN).

Task

You should take everything with a grain of salt! Try to check the output of the statements that are given in the task. They should be clear for Python too. Just output the code.

NaN - values that were not defined

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 4. Chapter 3
toggle bottom row

bookConverting: float()

Given that we have already acquired an understanding of the int() operation, it is unnecessary to reiterate the same information. The float() function serves a similar purpose, with the distinction of converting data into the floating-point data type.Look at this simple example:😁

1234567
variable1 = 56 variable2 = "98.7" variable3 = "5e4" print(float(variable1)) print(float(variable2)) print(float(variable3))
copy

It seems to me that one fascinating feature of the float() function should be noted. Not only can we represent regular numbers, but we can also represent concepts like infinity and Not a Number (NaN).

Task

You should take everything with a grain of salt! Try to check the output of the statements that are given in the task. They should be clear for Python too. Just output the code.

NaN - values that were not defined

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!

Given that we have already acquired an understanding of the int() operation, it is unnecessary to reiterate the same information. The float() function serves a similar purpose, with the distinction of converting data into the floating-point data type.Look at this simple example:😁

1234567
variable1 = 56 variable2 = "98.7" variable3 = "5e4" print(float(variable1)) print(float(variable2)) print(float(variable3))
copy

It seems to me that one fascinating feature of the float() function should be noted. Not only can we represent regular numbers, but we can also represent concepts like infinity and Not a Number (NaN).

Task

You should take everything with a grain of salt! Try to check the output of the statements that are given in the task. They should be clear for Python too. Just output the code.

NaN - values that were not defined

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