# Python Question - 2d lists

I am using 2d lists and I need to create a 2D list which includes the names of four salespeople. It needs to include the number of products sold in quarter 1 through to quarter 4
I then need to be able to enter the name of the salesperson and which sales quarter I wish to view.
I then need to output the name of the salesperson and the number of sales obtained in that quarter.
I also need to restrict the user to enter a number for the quarter that is below 1 or above 4.

Hi Ahmed,

What have you tried?

Show us the code you have tried to write.

salespeople = [‘Bob’,‘Tom’, ‘Eve’, ‘Rob’,]
SalesQ1 = [1,2,3,4],
SalesQ2 =[5,6,7,8],
SalesQ3 = [9,10,11,12],
SalesQ4 = [13,14,15, 15],
for i in range (0, len(salespeople[0])):
print(salespeople[0][i] + ’ ’ + str(salespeople[1][i]))
if salespeople == “Bob”:
print (‘Your sales were’ + SalesQ1[0] + SalesQ2[0] + SalesQ3[0] + SalesQ4[0])

salespeople = [‘Bob’,‘Tom’, ‘Eve’, ‘Rob’]
SalesQ1 = [1,2,3,4]
SalesQ2 =[5,6,7,8]
SalesQ3 = [9,10,11,12]
SalesQ4 = [13,14,15, 15]
List2d = [salespeople, SalesQ1, SalesQ2, SalesQ3, SalesQ4]
for i in range (0, len(List2d[0])):
print(List2d[0][i] + ’ ’ + str(List2d[1][i]))
if salespeople == “Bob”:
print ('Your sales were ’ + str(SalesQ1[0])+str(SalesQ1[1]))