Can anyone fix this code? The code isn't rounding the answer to the nearest whole number like 2.345 should be 2 and 2.546 should be 3 but the round() function isn't working as expected. The round() function is rounding 2.546 to 2 which is incorrect since 4 and below should be rounded to 2 and 5 and above should be rounded to 3.
Here is the code:
#importing xlwt library to write into xls
import xlwt
from xlwt import Workbook
#create a workbook
wb = Workbook()
#create a sheet
sheet = wb.add_sheet('Sheet')
#percentages list
percentages = [23.6, 38.2, 50, 61.8, 78.6, 113, 123.6, 138.2,
161.8]
#add first row
for i in range(len(percentages)):
sheet.write(0,i+1,str(percentages[i])+'%')
#user input
n = int(input('Enter number of elements: '))
#second row starts from index 1
row=1
print('Enter numbers: ')
for i in range(n):
#User input
val = float(input())
#Add entered value to first column of the row
sheet.write(row,0,str(val))
#calculate each percentage
for j in range(len(percentages)):
result =
(percentages[j]/100)*val
#write result to sheet by rounding
upto 3 decimal points
sheet.write(row,j+1,str(round(result,3)))
#increment the row by 1
row+=1
#save Workbook as xls`
wb.save('percentages.xls')
Thank you so much for anyone who helped!
In: Computer Science
International Accounting
What are the market transaction methods? Describe what is done in each of the market transaction methods.
what is the single rate / current rate translation methods? What is the temporal method? Describe what is done in each of the translations.
In: Accounting
In: Operations Management
Identify and explain two ways that human resources professionals
can support managers. Identify and explain two ways that
controllers can support managers. Why is it important for managers
to work collaboratively with controllers, human resource
professionals and other internal stakeholders and leaders within
the company?
In: Operations Management
Python Programming 4th edition: Write a program that asks the user for the number of hours (float) and the pay rate (float) for employee pay role sheet. The program should display the gross pay with overtime if any and without overtime. Hints: Given base_hr as 40 and ovt_multiplier as1.5, calculate the gross pay with and Without overtime. The output should look like as follows: Enter the number of hours worked: Enter the hourly pay rate: The gross pay is $XXX.XX
In: Computer Science
A director at an assisted living facility wants to offer a range of programs that support aging residents' cognitive functioning. What activities and interventions would you recommend, and why in 200 words.
In: Nursing
What is the process of removing data that you think is irrelevant (such as stop words) called?
Unsupervised learning |
||
Cleaning data |
||
Tabulating the census |
||
Untheorized research |
In: Computer Science
2.13 Program: Food receipt (Python 3)
1.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
2.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
Enter second food item name: ice cream
Enter item price: 2.50
Enter item quantity: 4
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
4 ice cream @ $ 2.5 = $ 10.0
Total cost: $ 20.0
3.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
Enter second food item name: ice cream
Enter item price: 2.50
Enter item quantity: 4
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
4 ice cream @ $ 2.5 = $ 10.0
Total cost: $ 20.0
15% gratuity: $ 3.0
Total with tip: $ 23.0
In: Computer Science
Suppose in July of 2008, the true proportion of U.S. adults that
thought unemployment would increase was 47%. In November of 2008,
the same question was asked to a simple random sample of 1000 U.S.
adults and 432 of them thought unemployment would increase. Can we
conclude that the true proportion of U.S. adults that thought
unemployment would increase in November is less than the proportion
in July? Use a 5% significance to test.
Round to the fourth
H0: Select an answer x̄ p̂ μ p Select an answer = <
> ≠
HA: Select an answer x̄ p̂ μ p Select an answer = <
> ≠
What's the minimum population size required?
How many successes were there?
Test Statistic:
P-value:
Did something significant happen? Select an answer Significance
Happened Nothing Significant Happened
Select the Decision Rule: Select an answer Reject the Null Accept
the Null Fail to Reject the Null
Select an answer: is or is not enough evidence to
conclude Select an answer that the true proportion of U.S. adults
that thought unemployment would increase in November is less than
0.47 that the true proportion of U.S. adults that thought
unemployment would increase in November is more than 0.47 that the
true proportion of U.S. adults that thought unemployment would
increase in November is 0.47
Build a 90% confidence interval and decide if you can conclude the
same. Use your calculator to do this and round to the fourth
decimal place.
( , )
Can we conclude the same as our Hypothesis Test?
Select an answer no yes because the true proportion of
U.S. adults in November 2008 that thought unemployment would
increase
In: Math
Many years ago, I was obliged to polish to a mirror finish the leather shoes and belt of a certain sergeant to a mirror finish. The only way of achieving the desired result was to use copious quantities of spit, a trick which was taught to me by various people who had spent time in the army. My question is ... why does spit enhance the shine of shoe polish? And perhaps a related question ... modern shoes don't seem to require polishing. What surface finish is applied in the manufacturing process which gives an everlasting shine?
In: Chemistry
Language is C++
NOTE:
No arrays should be used to solve problems and No non-constants
global variables should be used.
PART A: (Minusculo Inn)
Minusculo Inn has only eight guest rooms:
Room Number | Amenities |
---|---|
101 | 1 king size bed |
102, 103,104 | 2 double beds |
201, 202 | 1 queen size bed |
203, 204 | 1 double bed & sofa bed |
Write a program that asks for the room number and displays the amenities. If the user enters a room number that does not exist, the program should display “Input error”.
You must use a switch statement in your program to solve
this problem.
No Repetition Statements is needed in this problem. A User is only
making one selection.
The Minusculo Inn Restaurant has 4 lunch combos for customers to choose:
Combo A : Fried chicken with slaw [price:
$4.25]
Combo B : roast beef with mashed potato [price:
$5.75]
Combo C : Fish and chips [price: $5.25]
Combo D : soup and salad [price: $3.75]
Write a program to calculate how much a party of customers should pay. Suppose the party orders 2 B’s, 1 A and 3 D’s. The casher will enter B, B, A, D, D, D and T into the program. The T means “calculating total of the order”. It is a signal telling the computer that the whole order has been entered and it is time to calculate the total amount the party should pay. Assume there is no sales tax. The following is an example:
Enter item ordered [A/B/C/D] or T to calculate
total: B
Enter item ordered [A/B/C/D] or T to calculate total:
B
Enter item ordered [A/B/C/D] or T to calculate total:
A
Enter item ordered [A/B/C/D] or T to calculate total:
D
Enter item ordered [A/B/C/D] or T to calculate total:
D
Enter item ordered [A/B/C/D] or T to calculate total:
D
Enter item ordered [A/B/C/D] or T to calculate total:
T
Please pay this amount: $ 27
PART B: (Statistics program)
Write a program that reads the integers in the text file (user must enter name of file) and:
Displays the number of integers in the file (5 %)
Displays the number of even and odd integers (5%)
Displays the sum of the even integers and the sum of the odd
integers as well as the sum of all the integers (5%)
Displays the largest integer and the smallest integer (5 %)
Computes the average of the largest and smallest integer (10
%)
Compute the sum of ALL the digits in the input file (i.e. 123 475 –
Sum is 1+2+3+4+7+5 = 22) (15 %)
Assume the contents of the file are as follows:
123 475 61 77 910
234 138 134 95 674
345 31 211 952 873
22 7 876 347 450
The following is a sample output: User input is the 'integers.dat'
What is name of the input file?
integers.dat
The number of integers in the file is 20
There are 11 odd integers and 9 even integers
The sum of the odd integers is 2645
The sum of the even integers is 4390
The sum of all the integers is 7035
The largest integer is 952
The smallest integer is 7
The average of 952 and 7 is 479.5
The sum of all the digits is 212
NOTE:
Use two decimal point precision for the average
To check your code, adjust one of the integers in the file, recompile your code and run again (suggest changing the largest and smallest integers )
Even though there are 20 integers in the file, the program should NOT presume there are 20 integers. In other words, you should not solve this problem by declaring 20 integer variables. If I choose to use another integers.dat file other than the one provided with the assignment, your program should still work correctly with that file as well. All you can assume is that a series of integers will be read in from the file. Therefore, you need to implement a solution that uses the repetition control structures (for, while, do…while) in the reading and processing of these values to produce your output
In: Computer Science
Choose a website that is very poorly designed or not fully compliant with HTML5 standards and analyze its flaws. Create a presentation in which you describe its main issues and detail them thoroughly. Include images and source code if needed. It can be any website that you think could be done better
In: Computer Science
As part of their job responsibilities, engineers often have to make decisions related to the financial well-being of their organization. This includes the process of downsizing: reducing their staff and subcontracting the work/jobs. Some of the reasons for downsizing include:
Discuss the ethical issues and responsibilities associated with downsizing and how they related to the engineering code of ethics.
Note: you can just answer 1 out of the 4 topics listed above
In: Operations Management
A electronics manufacturer has developed a new type of remote
control button that is designed to operate longer before failing to
work consistently. A random sample of 28 of the new buttons is
selected and each is tested in continuous operation until it fails
to work consistently. The resulting lifetimes are found to have a
sample mean of ?¯x¯ = 1254.6 hours and a sample standard deviation
of s = 109.1. Independent tests reveal that the mean lifetime of
the best remote control button on the market is 1225 hours. Conduct
a hypothesis test to determine if the new button's mean lifetime
exceeds 1225 hours. Round all calculated answers to four decimal
places.
2. Which of the following conditions must be met to perform this
hypothesis test? Select all the correct answers.
A. The sample must be large enough so that at
least 10 buttons fail and 10 succeed.
B. The observations must be independent.
C. We must be able to expect that at least 5
buttons will fail to work consistently.
D. The number of remote control buttons tested
must be normally distributed.
E. The lifetime of remote control buttons must be
normally distributed.
3. Calculate the test statistic ? z t X^2 F =
4. Calculate the p-value
5. Calculate the effect size, Cohen's d, for this test. ?̂ d^ =
6. The results of this test indicate we have a...
A. small
B. large
C. moderate to large
D. small to moderate
effect size, and...
A. extremely strong evidence
B. some evidence
C. strong evidence
D. very strong evidence
E. little evidence
that the null model is not compatible with our observed result.
In: Math
The Cornchopper Company is considering the purchase of a new harvester. |
The new harvester is not expected to affect revenue, but operating expenses will be reduced by $14,600 per year for 10 years. |
The old harvester is now 5 years old, with 10 years of its scheduled life remaining. It was originally purchased for $91,000 and has been depreciated by the straight-line method. |
The old harvester can be sold for $22,600 today. |
The new harvester will be depreciated by the straight-line method over its 10-year life. |
The corporate tax rate is 21 percent. |
The firm’s required rate of return is 14 percent. |
The initial investment, the proceeds from selling the old harvester, and any resulting tax effects occur immediately. |
All other cash flows occur at year-end. |
The market value of each harvester at the end of its economic life is zero. |
Determine the break-even purchase price in terms of present value of the harvester. This break-even purchase price is the price at which the project’s NPV is zero. (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.) |
NOTE*** answer is not 91309.2 or 109154.41 or 110898.7 or 119875.42 or 117742.56
In: Finance