### Python 3 Engager Course (Free)

1) Interacting with the user
2) Common Data Types
5) Functions
6) Code Style
7) File Handling
8) Error Handling
9) Python Modules
10) Classes

# 2) a. Numbers

Lesson Progress
0% Complete

### Integers

Integer is one of the most widely used data types in Python. An integer variable holds a value of a whole number without a decimal part and it can be positive or negative.

 123 Output: Sum =  5 Multiplication =  -500

You can find the power of an integer by using the ** operator. A single asterisk is multiplication. A double asterisk is power.

While dividing numbers, you can get the remainder with % and the divisor with //.

 1234 Output: If I distribute 10 doughnuts among 4 people, each of them gets 2 doughnuts. At the end I should have 2 doughnuts still remaining. A \$1000 loan taken at 3.75% compound interest for 10 years will cost you \$ 1445.04394263

### Floats

Float variables hold a value of a number that has a decimal part and it can be positive or negative. Floats have limited precision which depends on the hardware capability of the computer.

Any mathematical equation that involves a float value will always result in float.

 1234 Output: 0.8 1.0 10.0

It is worth noting that if you divide an integer by another integer the result will always be a float.

 1234 Output: 2.0 0.5 2.0

How do you determine what type of value is stored in a variable? You can do this using the type built-in.

 123 Output: unknown_var1 =   unknown_var2 =