Dan G. - 6 months ago 20

Python Question

I am trying to write a method in Python 3.2 that encrypts a phrase and then decrypts it. The problem is that the numbers are so big that when Python does math with them it immediately converts it into scientific notation. Since my code requires all the numbers to function scientific notation, this is not useful.

What I have is:

`coded = ((eval(input(':'))+1213633288469888484)/2)+1042`

Basically, I just get a number from the user and do some math to it.

I have tried

`format()`

EDIT: I use only even integers.

Answer

In python3, `'/'`

does real division (e.g. floating point). To get integer division, you need to use `//`

. In other words `100/2`

yields `50.0`

(float) whereas `100//2`

yields `50`

(integer)

Your code probably needs to be changed as:

```
coded = ((eval(input(':'))+1213633288469888484)//2)+1042
```

As a cautionary tale however, you may want to consider using `int`

instead of `eval`

:

```
coded = ((int(input(':'))+1213633288469888484)//2)+1042
```