Question

Can someone make a python program that would allow the user to enter any amount of...

Can someone make a python program that would allow the user to enter any amount of numbers and multiply each number entered by 23.6%, 38.2%, 50%,61.8%,78.6%,113%,123.6%,138.2% and 161.8%. Every number the user enters get multiplied by every percent stated and the answer's will be produced in a excel like format where answers are lined up horizontally.

Thank you so much to anyone who helped!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

python code screenshot:

code to copy:

#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')

output screenshot:

result:

Add a comment
Know the answer?
Add Answer to:
Can someone make a python program that would allow the user to enter any amount of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the above described algorithm, create a program that: (IN PYTHON) 1.Asks the user which type...

    Using the above described algorithm, create a program that: (IN PYTHON) 1.Asks the user which type of credit card he/she would like to find the checksum for. 2. Based on the user's choice of credit card, asks the user for the n digits of the credit card. [Get the input as a string; it's easier to work with the string, so don't convert to an integer.] 3. Using the user's input of the n digits, finds the last digit of...

  • Python. Please attach python file if possible. All Instructions given: General The program must allow a...

    Python. Please attach python file if possible. All Instructions given: General The program must allow a trader to enter in stock's symbol, its current price, and a lucky number (see the validation rules for these inputs below). The program then outputs a recommendation to either buy, sell, or hold the stock. The recommendation is based on whether the current stock price is above, below, or equal to a particular threshold value specific to that stock (see more on the threshold...

  • Your program will ask the user to enter the amount of money they want to borrow,...

    Your program will ask the user to enter the amount of money they want to borrow, the interest rate, and the monthly payment amount. Your program will then determine how many months it will take to pay off that loan, what the final payment amount will be, and how much interest was paid over that time. If the monthly payment amount isn't high enough to pay off more than one month's interest, your program should notify the user what the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT