-2
I’m having trouble solving an array exercise in Python, can help?
Description: A store with 4 branches wants to register the daily sale of each branch for 1 week period. Create an array to store the sales. Write a feature that tells you which day of the week had the highest sales volume (including the 4 branches) and another that returns the number of the branch that had the highest weekly sales.
What I’ve done so far:
#Inserção dos valores para as matrizes 1x7, ja que são valores unitarios por dias da semana
loja_1=[[0,0,0,0,0,0,0]]
loja_2=[[0,0,0,0,0,0,0]]
loja_3=[[0,0,0,0,0,0,0]]
loja_4=[[0,0,0,0,0,0,0]]
def space():
print('===========================================')
#Laço para inserção de valores da filial 1
for l in range(1):
for c in range(0,7):
loja_1[l][c]=int(input('\nDigite o valor das vendas por dia da semana, para a filial 1: '))
#Laço para formatar os valores da matriz da filial 1
for l in range(1):
for c in range(0,7):
print([loja_1[l][c]],end='')
print()
space()
#Laço para inserção de valores da filial 2
for l in range(1):
for c in range(0,7):
loja_2[l][c]=int(input('\nDigite o valor das vendas por dia da semana, para a filial 2: '))
#Laço para formatar os valores da matriz da filial 2
for l in range(1):
for c in range(0,7):
print([loja_2[l][c]],end='')
print()
space()
#Laço para inserção de valores da filial 3
for l in range(1):
for c in range(0,7):
loja_3[l][c]=int(input('\nDigite o valor das vendas por dia da semana, para a filial 3: '))
#Laço para formatar os valores da matriz da filial 3
for l in range(1):
for c in range(0,7):
print([loja_3[l][c]],end='')
print()
space()
#Laço para inserção de valores da filial 4
for l in range(1):
for c in range(0,7):
loja_4[l][c]=int(input('\nDigite o valor das vendas por dia da semana, para a filial 4: '))
#Laço para formatar os valores da matriz da filial 4
for l in range(1):
for c in range(0,7):
print([loja_4[l][c]],end='')
print()
I stuck in the part: "Write a function that tells you which day of the week had the highest sales volume (including the 4 branches) and another that returns the number of the branch that had the highest weekly sales."
When I try to extract as many as loja_1
, error stating that list
is not eternal. I tried to convert list
for int
, used import heapq
, used max(loja_1)
, but I can’t. Some help?