Reputation: 563
The number can be very large
n = input()
print(n) #gives output in scientific notation
How to get the entire number?
PS: New to python
EDIT:
s = (input()) #100000000000000000000000000000000000000
if int(s[-1])%2 == 0:
print (2)
print (2)
print (int(s)/2) #5e+37
Upvotes: 3
Views: 2026
Reputation: 1162
You can format a large number into a scientific notation using the {:2E}
formatting code. Example:
>>> "{:.2E}".format(100000000000000000000000000000000000000)
'1.00E+38'
Another variation to do this:
>>> n = 100000000000000000000000000000000000000
>>> '%2E' % n
'1.000000E+38'
See this question for discussion about the stripping out the extra zeros from the output.
Upvotes: 1
Reputation: 500357
In Python 3, if you want integer division, use the //
operator:
print(int(s) // 2)
The result of the division will be an integer and will not get printed out in the scientific notation.
Upvotes: 3