Integers Flashcards

1
Q

system computers use to store numbers

A

binary

0 and 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

numbers handled by computers

A

integers - devoid of fractions

floating-points - contain fractions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The characteristic of the numeric value which determines its kind, range, and application, is called the

A

type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

simply a string of digits that make up the number. But there’s a reservation

like in death becomes her

A

you must not interject any characters that are not digits inside the number.

in other words you can use underscores but not

commas , 111,111,111 - NAY!!!
dot . 111.111.111 - NAY!!!
spaces 111 111 111 - NAY!!!

underscore 111_111_111 - HOORAH!!!!
no space 111111111 - HOORAH!!!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Negative numbers are created by adding the - BEFORE the number

A

You can write: -11111111, or -11_111_111.

HOORAH!!!!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

octal numbers

Doc Oc

A

0O or 0o prefix (zero-o)

[0..7] range only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

0o123 is an octal number with a (decimal) value equal

A

83

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

numbers should be preceded by the prefix 0x or 0X (zero-x).

[0..15] range only

A

hexadecimal

0x123 is a hexadecimal number with a (decimal) value equal to 291. The print() function can manage these values too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

represent and to store the numbers that (as a mathematician would say) have a non-empty decimal fraction.

A

floats

Whenever we use a term like two and a half or minus zero point four, we think of numbers which the computer considers floating-point numbers:

2.5
-0.4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

But don’t forget this simple rule - you can omit zero when it is the only digit in front of or after the decimal point.

A

In essence, you can write the value 0.4 as:

.4

For example: the value of 4.0 could be written as:

4.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Look at these two numbers:

4
4.0

You may think that they are exactly the same, but Python sees them in a completely different way.

A

4 is an integer number, whereas 4.0 is a floating-point number.

The point is what makes a float.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

it’s not only points that make a float. You can also use the letter e.

When you want to use any numbers that are very large or very small, you can use scientific notation.

A

Take, for example, the speed of light, expressed in meters per second. Written directly it would look like this: 300000000.

To avoid writing out so many zeros, physics textbooks use an abbreviated form, which you have probably already seen: 3 x 108.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Take, for example, the speed of light, expressed in meters per second. Written directly it would look like this: 300000000.

To avoid writing out so many zeros, physics textbooks use an abbreviated form, which you have probably already seen: 3 x 108.

It reads: three times ten to the power of eight.

In Python, the same effect is achieved in a slightly different way - take a look:

3E8

A

The letter E (you can also use the lower-case letter e - it comes from the word exponent) is a concise record of the phrase times ten to the power of.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

remember this!

A

the exponent (the value after the E) has to be an integer;
the base (the value in front of the E) may be an integer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly