+ 2
How do I fix a bug that displays "00" before my code
I just made a simple calculator, but it displays "00" before "The answer is", this also happened before I included this string https://sololearn.com/compiler-playground/cKP4O4A18BvH/?ref=app
4 Answers
+ 5
Remove the int() out of the input() calls.
Also, it might look a little nicer if you weren't converting string to int at the level of the display, but earlier. It makes clear that these values are integer. Also, later, it gives you the possibility to error check the input when attempting to convert non-integer values.
Means, you could do as follows:
a=int(input())
And then:
print(a - c)
A little explanation of what happens in your code: Apparently, int() called with no argument returns zero. And whatever is as parameter inside input() is taken as prompt and printed on screen prior to taking input. Hence, input(int()) prompts the return value of int() before taking input. Since you do that twice, you get "00" on the screen.
+ 4
a=int(input())
b=input()
c=int(input())
if b=="-":
print("The answer is:", a-c)
+ 2
I guess, there were some problem in comments. Or maybe that you used the int() function explicitly twice on a single variable. đ
No sure, but hope that the below solution may help you a bit. âșïž
https://sololearn.com/compiler-playground/cl9Y39hd17Gx/?ref=app
+ 2
Thanks to y'all for helping me :)