# cook your dish here t = int(input("")) print(t) i= 0 while i <= t: i += 1 if i > t: break d = int(input("")) x = int(input("")) y = int(input("")) z= int(input("")) a = 7*x if y > x: if d < 7: b = d * y if z < x: c = z * (7-d) sum = b + c print(max(a,sum))
Are you trying to “Run” without Providing “Custom Input"?
with the custom input
I have tried using
when I run it, there is no error displayed it displays all the expected output from custom input but when I Submit the answer it shows wrong answer.
The scope of your sum variable is limited to if block. initialize sum to some value after taking input.
btw it’s a good practice not to name your variables which have same name as built-in functions.
could you please specify it in the code which i have shared if possible. The mistakes and updates.
# cook your dish here try: # TODO: write code... T = int(input()) print(T) i= 0 while i <= T: i += 1 if i > T: break d, x, y, z = map(int, input().split()) a = 7*x if y > x: if d < 7: b = d * y if z < x: c = z * (7-d) sum = b + c print(max(a,sum)) except Exception: pass