0
29.9 Practice - Where’s my seat - Python
Can anyone get test cases 2, 3 and 4 to work. Here is my code that works for test case 1 but not the others. Thanks. seats = [ ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'], ['j', 'k', 'l'] ] print(seats[1][1])
9 Respostas
+ 2
Your code will always output 'e' as the seat, because you hard coded the indices.
+ 2
thanks ChaoticDawg im not sure what to do instead?
+ 2
Zach Z
I would need a description of the problem, because I do not have a pro subscription. The object for the challenges is to take into consideration the inputs, what should happen with them to get the desired output given any edge cases etc. Not just solve for particular outputs, but to give the correct output in the correct format for the given input regardless of what that input may be (within the limitations of the description of the challenge).
Try to think it through and solve the challenge yourself first. Then if you continue to have issues. Give a description of the issue and what you have tried so far. Save your current code for the challenge in the SoloLearn playground and provide a link to it, so we can help you further.
+ 1
got it!! thank you ChaoticDawg & Scott-Russell Clark
0
you will most likely have to loop through the inputs. something like....
N = inputs()
for x, y in N.split(“ “):
print(seats[x][y])
0
Try using input(), and have a read of the instructions.
For example:
row = int(input())
I hope this helps
0
Try this one, works for me:
(Here r stands for row and c for columns.)
seats = [
['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h', 'i'],
['j', 'k', 'l']
]
r = int(input())
c = int(input())
print(seats[r][c])
0
This one works too
seats = [
['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h', 'i'],
['j', 'k', 'l']
]
#your code goes here
x = int(input())
y = int(input())
c = (seats[x][y])
print (c)
0
that code isnt working ugh