GoConqr has a new look! Let us know what you think.

Module 7 of 24 · Text

Coding floats

David Khieu

Coding Floats

Let's see how this convention is used to record numbers that are very small (in sense of their absolute value, which is close to zero). 

A physical constant called Planck's constant (and denoted as H) according to the textbooks, has the value of: 6.62607 x 10^-34.

If you would like to use it in a program, you should write it this way: 

6.62607E-34

Note: the fact that you've chosen one of the possible forms of coding float values doesn't mean that Python will present it the same way. 

Python may sometimes choose different notation than you. 

For example, let's say you've decided to use the following float literal: 

0.000000000000000000000001

When you run this literal through Python: 

Print(0.00000000000000001)

This is the result: 

1e-22

Python always chooses the more economical form of the number's presentation, and you should take this into consideration when creating literals. 

 

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?