def get_the_buyer_id_spent_most_and_the_money_spent(): dictionary = sales.get_all_sales_ids_for_customer_ids() maxim = 0 for i in dictionary: if sales.get_the_sum_of_prices(dictionary[i]) > maxim: maxim = sales.get_the_sum_of_prices(dictionary[i]) max_id = i return (max_id, maxim)
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's id who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ # your code dicc=sales.get_all_sales_ids_for_customer_ids() lmao=[] for key, value in dicc.items(): temp=[key,value] lmao.append(temp) sums=[] for i in range(len(lmao)): for j in range(len(lmao[i])): sums.append(sales.get_the_sum_of_prices(lmao[i][j])) highest=sums[0] place=0 for i in range(len(sums)): if highest<sums[i]: highest=sums[i] place=i-1 ID=lmao[place][0] reli=[ID,highest] return tuple(reli)
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's name who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ # your code dicc=sales.get_all_sales_ids_for_customer_ids() lmao=[] for key, value in dicc.items(): temp=[key,value] lmao.append(temp) sums=[] for i in range(len(lmao)): for j in range(len(lmao[i])): sums.append(sales.get_the_sum_of_prices(lmao[i][j])) highest=sums[0] place=0 for i in range(len(sums)): if highest<sums[i]: highest=sums[i] place=i-1 ID=lmao[place][0] andhisnameisJOHNCENA=crm.get_name_by_id(ID) reli=[andhisnameisJOHNCENA,highest] return tuple(reli)
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's _name_ who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ # your code sales_id_dict = sales.get_all_sales_ids_for_customer_ids() list_of_tuples = [] for key in sales_id_dict.keys(): sum_per_id = sales.get_the_sum_of_prices(sales_id_dict[key]) list_of_tuples.append((key, sum_per_id)) maxi = list_of_tuples[0][1] returnable_list = [] for elem in list_of_tuples: if elem[1] > maxi: maxi = elem[1] for elem in list_of_tuples: if elem[1] == maxi: returnable_list.append((crm.get_name_by_id(elem[0]), elem[1])) ui.print_result(returnable_list,'Most frequent buyer(s) Name(s).')
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ # your code sales_id_dict = sales.get_all_sales_ids_for_customer_ids() list_of_tuples = [] for key in sales_id_dict.keys(): sum_per_id = sales.get_the_sum_of_prices(sales_id_dict[key]) list_of_tuples.append((key, sum_per_id)) maxi = list_of_tuples[0][1] returnable_list = [] for elem in list_of_tuples: if elem[1] > maxi: maxi = elem[1] for elem in list_of_tuples: if elem[1] == maxi: returnable_list.append((elem)) ui.print_result(returnable_list,'Most frequent buyer(s) ID.')
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's _name_ who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ # your code FIRST = 0 ID = 1 cmr_price = [] list_of_prices = [] all_IDs = sales.get_all_sales_ids_for_customer_ids() for key, value in all_IDs.items(): cmr_price.append( (crm.get_name_by_id(key), sales.get_the_sum_of_prices(value))) maxnum = cmr_price[FIRST][ID] for tuple in cmr_price: list_of_prices.append(tuple[ID]) maxnum = max(list_of_prices) for cmr in cmr_price: if cmr[ID] == maxnum: return cmr
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ # your code FIRST = 0 PRICE = 1 cmr_price = [] list_of_prices = [] customer_sales = sales.get_all_sales_ids_for_customer_ids() for key, value in customer_sales.items(): cmr_price.append((key, sales.get_the_sum_of_prices(value))) maxnum = cmr_price[FIRST][PRICE] for tuple in cmr_price: list_of_prices.append(tuple[PRICE]) maxnum = max(list_of_prices) for cmr in cmr_price: if cmr[PRICE] == maxnum: return cmr
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ tmp = [] dictionary = sales.get_all_sales_ids_for_customer_ids() for key, value in dictionary.items(): if not tmp: tmp.append((key, sales.get_the_sum_of_prices(value))) elif sales.get_the_sum_of_prices(value) > tmp[0][1]: tmp[0] = (key, sales.get_the_sum_of_prices(value)) return (tmp[0][0], tmp[0][1])
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's _name_ who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ tmp = [] dictionary = sales.get_all_sales_ids_for_customer_ids() for key, value in dictionary.items(): if not tmp: tmp.append((key, sales.get_the_sum_of_prices(value))) elif sales.get_the_sum_of_prices(value) > tmp[0][1]: tmp[0] = (key, sales.get_the_sum_of_prices(value)) return (crm.get_name_by_id(tmp[0][0]), tmp[0][1])
def get_the_buyer_id_spent_most_and_the_money_spent(): result = [] money_spent_by_customers = [] ids_dict = sales.get_all_sales_ids_for_customer_ids() for key, value in ids_dict.items(): ids_dict[key] = sales.get_the_sum_of_prices(ids_dict[key]) money_spent_by_customers.append(ids_dict[key]) max_money_spent = max(money_spent_by_customers) for key, value in ids_dict.items(): if max_money_spent == ids_dict[key]: result.append(key) result.append(max_money_spent) return tuple(result)
def get_the_buyer_id_spent_most_and_the_money_spent(): # Eszti """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ sales_ids_to_customer_id = sales.get_all_sales_ids_for_customer_ids() customer_and_max_spent_money = [None, 0] MONEY = 1 for customer_id, sales_ids in sales_ids_to_customer_id.items(): sum_of_prices = sales.get_the_sum_of_prices(sales_ids) if sum_of_prices > customer_and_max_spent_money[MONEY]: customer_and_max_spent_money = [customer_id, sum_of_prices] return tuple(customer_and_max_spent_money)
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ # 4 most_sales = sales.get_num_of_sales_per_customer_ids() id_ = '' for key, value in most_sales.items(): if value == max(most_sales.values()): id_ = key all_sale_ids = sales.get_all_sales_ids_for_customer_ids() sum_sales = sales.get_the_sum_of_prices(all_sale_ids[id_]) return (id_, sum_sales)
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's _name_ who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ names = sales.get_all_sales_ids_for_customer_ids() new_dict = {} for key, values in names.items(): new_dict.update( {crm.get_name_by_id(key): sales.get_the_sum_of_prices(values)}) valami = [] for key, values in new_dict.items(): valami.append((key, values)) result = valami[0] return result
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns: tuple: Tuple of customer id and the sum the customer spent eg.: (aH34Jq#&, 42) """ names = sales.get_all_sales_ids_for_customer_ids() new_dict = {} for key, values in names.items(): new_dict.update({key: sales.get_the_sum_of_prices(values)}) valami = [] for key, values in new_dict.items(): valami.append((key, values)) result = valami[0] return result
def get_the_buyer_name_spent_most_and_the_money_spent(): """ Returns the customer's _name_ who spent the most in sum and the money (s)he spent. Returns: tuple: Tuple of customer name and the sum the customer spent eg.: ('Daniele Coach', 42) """ # 3 most_sales = sales.get_num_of_sales_per_customer_ids() id_ = '' for key, value in most_sales.items(): if value == max(most_sales.values()): id_ = key name = crm.get_name_by_id(id_) all_sale_ids = sales.get_all_sales_ids_for_customer_ids() sum_sales = sales.get_the_sum_of_prices(all_sale_ids[id_]) return (name, sum_sales)
def get_the_buyer_id_spent_most_and_the_money_spent(): """ Returns the customer's _id_ who spent more in sum and the money (s)he spent. Returns a tuple of customer id and the sum the customer spent. eg.: (aH34Jq#&, 42) Returns: Tuple of customer id and the sum the customer spent """ max_spent_money_cust_id = None max_spent_money = 0 cust_id_sales_id = sales.get_all_sales_ids_for_customer_ids() for key, value in cust_id_sales_id.items(): sum_of_one_cust = sales.get_the_sum_of_prices(value) if sum_of_one_cust > max_spent_money: max_spent_money = sum_of_one_cust max_spent_money_cust_id = key return max_spent_money_cust_id