# Python Programming Assignments: Integer and Floating-Point Number Operations

Python programming assignments are sometimes very difficult to complete. If you are having troubles with such an assignment, you should get help from AssignmentShark. No matter how difficult your task seems to be, we’ll deal with it. We hire the best experts – they are highly knowledgeable in their specific disciplines. Before hiring them, we thoroughly test experts on their knowledge in the specified field. That way, we can be confident that our candidates are capable of providing our clients with high-quality examples.

As we already mentioned, our samples are high-quality. One more advantage of using them is that they are free. You have the ability to get acquainted with the entire sample without payment. However, we also have a paid option. Our paid option you can use in case you need a specific example that will help you to complete your Python programming assignments. Both paid and free code examples are completed by our best experts. The only difference is that free examples are completed within our requirements, and the paid documents, within yours.

The sample that you can read below was completed by one of our experts. You can use it as an example for your own task. Also, you have the ability to order a similar example with your specific requirements. You should do this without hesitation if you can’t understand the topic and you need the assignment to be done urgently. Don’t wait till the last minute! Examine our sample right away and make your final decision!

## Operations With Integer and Floating-Point Numbers

The integer arithmetic

For integers, the operations `+`, `-`, `*` and `**` are determined. Division operation `(/)` for integers returns a real number (float value). The exponentiation returns a float if the exponent is a negative number.

But there is a special integer division operation which performs a discarding of the fractional part of the number `(//)` (it corresponds to the operation div in Pascal). It returns an integer part of the quotient. Another similar operation takes the remainder of the division `(%)` (which corresponds to the operation mod in Pascal). For example:

```print (17/3) # prints 5.66666666667
print (17.3) # prints 5
print (17% 3) # prints 2
```

Real numbers

Please note that if you want to read a real number from the keyboard, then the result returned by the input() function must be converted to the float type:

```x = float(input())
print(x)
```

Floating point numbers in the language of Python are recorded as follows: mantissa, e letter, the order. There are no spaces in this record.

Recall that the result of the operation `/` is always a real number (float), while the result of the operation `//` is an integer (int).

Conversion of the real numbers is made with the rounding towards zero, that is, `int (1.7) == 1`, `int (-1.7) == -1`.

Math library

To perform calculations with real numbers, the Python language has many additional functions, collected in a library, which is called “math”.

To use these functions you need to connect math library in the beginning of the program:

```import math
```

For example, suppose we want to round the real number to the nearest integer number. The corresponding function `ceil` with one argument is invoked like this: `math.ceil (x)`. Any number can be put instead of x. It can be a variable or an expression. The function returns the value that can be displayed on the screen, assigned to another variable or used in the expression:

```import math
x = math.ceil(4.2)
y = math.ceil(4.8)
print(x)
print(y)
```

Another way to use the functions fro, the math library, which does not need to specify the name of the module every time you use the function fro, the math module is as follows:

```from math import ceil
x = 7 / 2
y = ceil(x)
print(y)
or so:
from math import *
x = 7 / 2
y = ceil(x)
print(y)
```

You can see the whole list on the Python official website: https://docs.python.org/2/library/math.html.