Chapter 3 Computing with numbers Flashcards
What is data?
information that is stored and manipulated by computer programs
What are the main two data types covered in this chapter?
integer data (int) and floating point data (float)
what is the main difference between integers and floats?
floats are numbers that have fractional parts represented while integers are whole numbers.
What special function can you run if you are confused on type of data a value is?
> > > type
ex:
type (3)
True or False
Using an int value tells the reader of the program that the value can support fractions.
False
What is another difference between floats and ints?
floats can only represent approximations to real numbers. Because of this, it is usually a good rule of thumb to use
True or False
Since floating point numbers are extremely accurate, they should generally be used instead of ints.
False
True or False
In Python, 4+5 does not produce the same result type as 4+5.0 .
True
In order to use functions in the math library, a program must include:
An import statment
The most appropriate data type for storing the value of Pi is:
a float
Accumulator structure?