#๐Ÿ”’ 2d array/list

8 messages ยท Page 1 of 1 (latest)

brittle ridge
#
#TASK 31 : make a 2d array to store sales of 5 salespersons' sales for 12 months
#TASK 32 : ask user to enter sales for each sales person for each month
#TASK 33 : calculate the average sales for each sales person and average sales of all salesperson
#TASK 34 : find the highest and lowest sales month for each sales person
#TASK 35 : make a 1d array bonus, that calculates bonus for each sales person based on the formula
# total of 10% of (sales for the month * month number)
sum1 = 0
lowest = 9999999999
highest = 0
sales = [[ 0 for months in range(3)] for salesperson in range(5)]
for salesperson in range(5):
    print("Enter sales for sales person number", salesperson + 1)
    for months in range(3):
        print("Enter sales for month", months + 1, ":")
        sales[salesperson][months] = int(input())
for salesperson in range(5):
    for months in range(3):
        print(sales[salesperson][months],  end = "")
    print()


for months in range(3):
    for salesperson in range(5):
        sum1 += sales[salesperson][months]
print("Average sales person number 1:", sum1/3)
print("Average sales person number 2:", sum1/3)
print("Average sales person number 3:", sum1/3)
print("Average sales person number 4:", sum1/3)
print("Average sales person number 5:", sum1/3)

for salesperson in range(5):
    if highest < sales[salesperson][months]:
        highest = sales[salesperson][months]
        print("Highest for salesperson", salesperson + 1, "is", highest )

for salesperson in range(5):
    if lowest > sales[salesperson][months]:
        lowest = sales[salesperson][months]
        print("Lowest for salesperson", salesperson + 1, "is", lowest )
frail pythonBOT
#

@brittle ridge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

raw sand
#

whats the problem?

brittle ridge
#

wait ๐Ÿ˜ญ

#

ill open again in a few mins

#

!close

frail pythonBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.