0
Python questions (abs)
Solution is listed as 3. Any idea why this isn't 17 (equation below)? "What is the output of this code? j=10 jj=4 i=3+4 j=4 If j>abs(i): print (i+j) else: print(abs(i-jj))" -abs is absolute (highest integer). -j is 10 which is > than any other number (4, 3+4, or 4. -So why is the solution given as 3 and not 17 (i+j)? -Thanks for any help:).
4 odpowiedzi
+ 5
It's giving 17 as output. Try re-checking the answer.
+ 3
tristach605 j got updated before if condition and it's holding 4 now which is less than i= 7.. so else condition is gonna executed... 7-4 = 3 is correct answer
+ 1
Thanks Shashi and Ketan👍🏻
0
I made a mistake in the origibal post. Have now edited it. Any help appreciates.