Define two global variables bigtotal and maximumshare and


Can you help me with my code, it is not working properly

Define two global variables: big_total and maximum_share and initialize both of them to 0.

Function called share_items that takes 2 parameter arguments: a total_number_of_items, and the the number_of_people sharing the items. This function should use divide_with_remainder to figure out how much each person gets (whole) and what is left over (remainder). It also should update the 2 global variables as follows: (i) big_total should be the total of all instances of total_number_of_items; and (ii) maximum share should increase by whole if remainder is 0 and increase by whole + 1 if remainder is greater than 0. Basically big_total is the total of things that are being divided over all and maximum_share is the largest amount that one person would receive if all participants shared the items being distributed in a mostly-fair way (some people got one extra when there was a remainder).

Function called question_1() that calls share_items at least 3 times and shows that it works. For example, the following instance of question_1, calls share_items 3 times: the first time with arguments of 10 and 4; the second time with arguments of 20 and 3; and the third time with arguments of 14 and 7. Then it puts big_total and maximum_share in a print statement. Here is what it looks like to call that function and for the result to print out:

>>> question_1()

The total is 44 and the maximum share is 12

# Question 1

big_total = 0

maxiumim_share = 0

def div_w_remainder(divedend, divisor):

  whole = dividend // divisor

  remainder = diidend % divisor

  return( whole, remainder)

def share_items(total_number_of_items,number_of_people):

  whole, remainder = div_w_remainder()

  global = big_total

  global = maximum_share

    big_total += total_number_of_items

    if remainder == 0:

      maximum_share += whole

    if ramainder > 0:

      maximum_share += whole +1

def question_1():

  div_w_remainder()

  share_items()

  print(" The total is", big_total," and the maxium share is", maxiumum_share)

Solution Preview :

Prepared by a verified Expert
Business Management: Define two global variables bigtotal and maximumshare and
Reference No:- TGS02944384

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)