Define two global variables

Assignment Help Business Management
Reference no: EM132150935

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)

Reference no: EM132150935

Questions Cloud

Regards to mandatory access control : In regards to mandatory access control a user with a secret security clearance is able to write a document which may later be classified as top secret true
What are the long-term consequences of such trade : What are the long-term consequences of such trade for Tanzania?Do you see both negative and positive outcomes?
Uses the internet control message protocol : An attack that uses the Internet Control Message Protocol (ICMP) to flood a victim with packets.
What are the different types of commercial risks : What are the different types of commercial risks and how can managers plan for them to ensure minimal impact to the company?
Define two global variables : Define two global variables: big_total and maximum_share and initialize both of them to 0.
Propose a communication plan that builds on these efforts : Select one health behavior that is consistent with your final assignment topic and two health communication initiatives directed at that behavior.
Employees in it organization : Write down a policy listing expected ethical conduct characteristics for your employees in your IT organization.
Problem caused by a denormalized design : Describe the update problem caused by a denormalized design?
Identify the different types of forecasts : Identify the different types of forecasts that can be developed for use by a company.

Reviews

Write a Review

Business Management Questions & Answers

  How do they assist in keeping coca-cola strategies

How would you describe Coca-Cola's control systems (budgets, inventory control, annual objectives, functional strategies, policies and procedures

  Ozco boats case study

OzCo Boats is a family-owned boat building business based in Coffs Harbour, New South Wales. Operating since1961, OzCo designs and builds high quality

  Ethical issues raised by mining customer databases

Are there any ethical issues raised by mining customer databases? Explain your answer.

  Improvement teams blame human errors for harm to patients

Most quality improvement teams blame human errors for harm to patients. Is this true? Why or why not - Review the following scenario and justify your discussion about it.

  Case assignment-managing change analysis of hypotheticalcase

Identify the objectives or key points in the assignment - Discuss and critically evaluate the different types of organisational change - Managing Change

  Company with long-term sustainability

TPC is undertaking CSR activities in six thrust areas; are the processes and people involved well-defined for the six thrust areas? How far will these activities help the company with long-term sustainability?

  Transformational and contingency leadership theories

Emotional Intelligence is related to both transformational and contingency leadership theories. Can self-awareness and the ability to detect emotions in others.

  Clarify the leadership style of this leader

BUS413 -  Write a brief Biography and historical analysis that explain the origins and significance events of the leader and explain the main qualities of this leader that affect success in five aspects of his life, with examples.

  Particular media file a good choice for a presentation

What are some examples of sound and video files that can be inserted into a presentation? What makes a particular media file a good choice for a presentation?

  Describe a replacement information system

Describe a replacement Information System that could have been utilized to provide a solution and enhance the efficiency of your efforts.

  Which is most closely related with the organic growth

Which of the following is most closely related with the organic growth of an organization? Which of the following steps will help service firms to increase their quality control?

  What is the effect of a lump-sum tax

What is the effect of a lump-sum tax (which is like an additional fixed cost) on a monopoly?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd