I decide 'Argentina' In SoloLearn and I got this code. The fifth test doesn't work, what's the problem? https://code.sololearn.com/c9hlg6UfgJhT/?ref=app
A simple approach to find solution by the logic is 50 pesos= 1 dollor
Well, lets say that we're using signed char's, whose range is -128 to 127. If you had a number, lets say 100, and multiplied it by 2, you'd get 200 which is too big for the type to handle. So it wraps around to -128 and starts counting from there. The final result would be -56. This is called overflow. If the reverse happened, it would be called underflow. The solution would be to use a type that has a bigger range, so that the multiplied value would be stored without causing overflow, or by changing your strategy, for example by not multiplying.
This is a challenge from this app. It's called 'Argentina'. I can't solve it to the end.
The 5th test causes an overflow if you multiply.
It's hard to explain when you don't know English well
Overflowing is like?
Thank you, solved the problem through division, but what you're saying can come in handy later
The Easiest code to solve this problem: a = int(input("")) b = int(input("")) c = int(a / 50) if c > b: print("Dollars") else: print("Pesos")
A regular unsigned int can only store numbers until about 2.1 billion. After that, it starts over from the bottom (-2.1 billion). This is called overflow. You can prevent (or rather alleviate) this problem by using a bigger number type, for example long long.
Someone help https://www.sololearn.com/Discuss/2184619/?ref=app
For anyone who's having trouble understanding I tried to change around the code so it's an easy read peso = int(input()) USD = int(input()) rate = peso * 0.02 if rate > USD: print('Dollars') else: print('Pesos')
I think there is overflow and your program doesn' t have "return 0;". Good lock
Remove "/" from p /=50