Reference no: EM13966212
Question:
def sma(list1,n):
"""Returns simple moving average of a list of numbers in size n"""
count = 0
result = [0]*(len(list1)-n+1)
for item in range(len(result)):
result[count] = arithmetic_mean(list1[count:count+n])
count += 1
print count
return result
why is this code not working? (python) I dont think the for loop is going through because counter never goes off 1.
For example, sma([5, 2, 8, 3, 7, 4], 3) should return [5, 4.3333333, 6, 4.666667], which consists of four averages: (5+2+8)/3, (2+8+3)/3, (8+3+7)/3, and (3+7+4)/3. Note that if the length of the input list is less than or equal to n, then the result list contains just one number, the list's mean.
What is stress and what are stressors
: What is stress? What are stressors? Can stress be good? Describe the difference between a Type A and Type B personality? Which are you? Which would you prefer to manage? Why?
|
Plant assets and depreciation methods problem
: Century Company negotiated a lump-sum purchase of several assets from a contractor who was retiring.PLANT ASSETS AND DEPRECIATION METHODS PROBLEM
|
Business is worth more than the price of its stock
: Jorge makes the comment that a "business is worth more than the price of its stock. 'He is of course referring to the family values and social value of the firm.(Ignore this).
|
Interview questions-describe a humbling experience
: Describe a humbling experience. You seem pretty positive, what types of things bring you down? Why should we hire you? Describe yourself, what excites you?
|
Which consists of four averages:
: Why is this code not working? (python) I dont think the for loop is going through because counter never goes off 1. For example, sma([5, 2, 8, 3, 7, 4], 3) should return [5, 4.3333333, 6, 4.666667], which consists of four averages: (5+2+8)/3, (2+8+3..
|
Budgeted production of mink caress
: Two grams of musk oil are required for each bottle of Mink Caress, a very popular perfume made by a small company in western Siberia. The cost of the musk oil is $1.70 per gram. Budgeted production of Mink Caress is given below by quarters for Year 2..
|
Determining the least-squares line appropriate
: An experiment was conducted to observe the effect of an increase in temperature on the potency of an antibiotic. Three one ounce portions of the antibiotic were stored for equal lengths of time at each of the following Fahrenheit temperatures: 40?..
|
What is involved in project scope management
: Briefly describe what happens in each of the five project management process groups (initiating, planning, executing, monitoring and controlling, and closing). What types of activities are done before initiating a project? What is involved in project..
|
What is the angular frequency
: Let sin(α) = cos(α+β). Expand cos(α+β) with the appropriate trigonometric angle addition formula and find a value for β. Let cos(α) = sin(α+β). Expand sin(α+β) with the appropriate trigonometric angle addition formula and find a value for β.
|