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

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

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