Here is my code:
n=input()
n=int(n)
print(n)
When I give the value 446486416781684178, it prints the same value but stores 446486416781684160. I don't know why.
I attached the screenshot below. I have used an online debugger.
I was using onlinegdb.com. But the real problem was different.The problem was: The user has to give a number and the code has to find out how many 4's and 7's are there.So my code was:
n=input()
n=int(n)
ld=0
while True:
a=n%10
if a==4 or a==7:
ld=ld+1
n=int(n/10)
if n==0:
break
print(ld)
It worked perfectly for many random values.But when I entered this number:446486416781684178,the answer should be 7 as there is total seven 4's and 7's.Instead it gave me 6.So I used that online debugger to find out my problem.Then I realized that it was storing 446486416781684160 as I mentioned before.So the answer was 6 as it was calculating 446486416781684160 instead of 446486416781684178
