Integers and Real Numbers
Integers are whole numbers or numbers without decimals.
Example: 1, 2, 5, 10
Real Numbers and Float types numbers have decimals.
Example: 1.5, 2.7, 5.98, 10.99
FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes.
DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes.
REAL is a synonym of FLOAT for now.
In the following program we'll use commands to allow for float and integers. These commands are:
From the output you can see the following effects
Converting Strings to Integers
int() can also be used to convert a string to an integer. Once it is an integer, you can perform mathematical functions on it.
float() can be used to convert a string to a number with a decimal.
Try the example below:
SHORTCUTS
You can put an input statement inside of the float() function to save a line if you ever just need a float entered.
For an example, try the following program:
Assignment #10
Create a program that asks you how may eggs you have.
The output should look like the following.
Goal : Do this without using While True or Break (regular while loops are ok, I'm just saying that you shouldn't use a While True with a Break because it's considered bad form) in under 28 lines including your name on line 1 in comments.