My issue
Im running the code in python can anyone help
My code
test_case=input("The number of test cases")
integerX=input("Type the integer X")
integerY=input("Type the integer Y")
integerX=int(integerX)
integerY=int(integerY)
if integerX+integerY >6:
print("YES")
else:
print("NO")
Problem Link: GDTURN Problem - CodeChef
@asur1817
There seems to be a few error in your code.
- Printing statements while taking input: You should not print anything except the solution that is stated in problem statement. It causes the code to fail even if the logic is right.
In your code;
test_case=input("The number of test cases")
It prints the statement in double quotes which is not seen as correct by the answer verifying program.
- Taking input in different format: See the given problem statement and test cases. They clearly state how the inputs are to be taken.
In your code;
integerX=input("Type the integer X")
integerY=input("Type the integer Y")
integerX=int(integerX)
integerY=int(integerY)
You haven not even properly taken input as required by python.
- Not using loops to calculate all test cases: In most problem statements, there are t number of test cases which need to be calculated and output produced/ printed.
Here, you have just taken t but it isn’t being used.
Refer to the following code to see how the problem statements are generally solved.
# cook your dish here
for i in range(int(input())): //taking input and running loop for 't' test cases
x,y=map(int,input().split()) //taking input using in-built functions
if((x+y)>6):
print('yes')
else:
print('no')
Finally, i would suggest completing the learning module for the language of your choice first before you start solving problems to get a better understanding of the code.