user3395662 user3395662 - 7 months ago 26
Python Question

Can someone tell me the difference between these two python codes? I'm having a test in 2 hours, any help is appreciated

Thanks in advance.

a=int(input("Unesi a: "))
b=int(input("Unesi b: "))

I do not understand what the difference is because it does the same thing.

d=input("Unesi c: ")
e=input("Unesi d: ")


Both code snippets ultimately do the same thing, provided that the input is valid for a b d and e. If the input is not a number, a and b will give you a ValueError right away, since you're evaluating the string input to an int immediately. d and e will accept any sort of input, including those with non numerical data, but you'll get the same ValueError when doing the addition. Same result, different timing when errors occur.