My issue
My code
# Update the '_' below to solve the problem
#accept the count of test cases given in the the 1st line
t = int(input())
#run a loop to accept 't' inputs
for i in range(t):
#accept 2 integers on the 1st line of each test case
A, B = map(int,split( ))
#accept 3 integers on the 2nd line of each test case
C, D, E = map(int,split( ))
#output the 5 integers on a single line for each test case
print(A, B, C, D, E)
Learning course: Python for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone
As you mentioned their are couple of issues with the provided code snippet. I will correct them and provide you with the corrected one :
# Accept the count of test cases given in the first line
t = int(input())
# Run a loop to accept 't' inputs
for i in range(t):
# Accept 2 integers on the first line of each test case
A, B = map(int, input().split())
# Accept 3 integers on the second line of each test case
C, D, E = map(int, input().split())
# Output the 5 integers on a single line for each test case
print(A, B, C, D, E)
now, here is the explanation of the above correctly written code
- Replaced
split() with input().split() in the map() function. This will split the input string on whitespace and map the resulting values to integers.
- Added proper indentation to ensure the code runs correctly within the loop.
With these modifications, the code will now accept the required inputs and output the 5 integers on a single line for each test case.