Question

The RSC Bookstore is having a three-day sale during which the price of any unsold t-shirt...

The RSC Bookstore is having a three-day sale during which the price of any unsold t-shirt drops 15 percent each day. For example, t-shirt that costs $15.00 on the first day costs 15 percent less, or $12.75, on the second day. On the third day, the same item is 15 percent less than $12.75, or $10.84. Design a python script that will input 5 different t-shirt prices. Output is the original price of each item first day, discounted on day2 and discounted on day3. Print the original price and the price on the 2nd and 3rd days.

1. Ask the user to input the price.

2. Use a loop to request each input a. use a While loop ask the user to enter 999 to end.

3. Print the 3 prices for each discount for each t-shirt price the user inputs

. 4. See the attached image of the output results when the user enters the prices below

. 5. Use a function. Depending upon which part you put in the function will determine whether you need to pass the input into the function

6. include pseudcode

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


Given below is the code (tested on python 3.5) for the question.
Make sure to indent the code exactly as shown in image. Indentation gets lost when code is uploaded on Chegg site
Please don't forget to rate the answer if it was helpful. Thank you

1 def discountPrice(price): return price 0.15 * price 4 def main): done False while not done: price- float (input ( Enter price of shirt (type 999 to quit): )) if price 999: 8 done = True 10 else: for i in range(1, 4): 12 13 14 15 16 if-name-=. main- 17 18 #loop for i-1, 2, 3 print( Day : price is $:.2f.format(i, price)) price-discountPrice(price) main()

def discountPrice(price):
return price - 0.15 * price

def main():
done = False
while not done:
price = float(input('Enter price of shirt (type 999 to quit): '))
if price == 999:
done = True
else:
for i in range(1, 4):
#loop for i = 1, 2, 3
print('Day {}: price is ${:.2f}'.format(i, price))
price = discountPrice(price)

if __name__ == '__main__':
main()

output
------
Enter price of shirt (type 999 to quit): 15
Day 1: price is $15.00
Day 2: price is $12.75
Day 3: price is $10.84
Enter price of shirt (type 999 to quit): 20
Day 1: price is $20.00
Day 2: price is $17.00
Day 3: price is $14.45
Enter price of shirt (type 999 to quit): 999

Add a comment
Know the answer?
Add Answer to:
The RSC Bookstore is having a three-day sale during which the price of any unsold t-shirt...
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
  • (JAVA) Write a program that deals with inflation, which is essentially the rising cost of general goods over time.

    IN JAVAWrite a program that deals with inflation, which is essentially the rising cost of general goods over time. That is, the price of goods, such as a packet of peanuts, goes up as time goes by. So, you will write a program to gauge the expected cost of an item in a specified number of years. The program asks for the cost of the item, the number of years, and the rate of inflation. The output is the estimated...

  • WRITE JAVA PROGRAM Problem Statement You are required to write a stock price simulator, which simulates...

    WRITE JAVA PROGRAM Problem Statement You are required to write a stock price simulator, which simulates a price change of a stock. When the program runs, it should do the following:  Create a Stock class which must include fields: name, symbol, currentPrice, nextPrice, priceChange, and priceChangePercentage.  The Stock class must have two constructor: a no-argument constructor and a constructor with four parameters that correspond to the four fields. o For the no-argument constructor, set the default value for...

  • Python 3 coding with AWS/IDLE. DDI&T a Python program to input, store, and process hourly temperatures for each hour...

    Python 3 coding with AWS/IDLE. DDI&T a Python program to input, store, and process hourly temperatures for each hour of the day (i.e., 24 temperatures). Your program should be divided logically into the following parts: In function main() declare an empty List container:          HourlyTemperatures = []     Pass the empty HourlyTemperatures list to a function, GetTemperatures(HourlyTemperatures)          This function must interactively prompt for and input temperatures for each of the 24 hours in a day (0 through 23). For each temperature that...

  • c++ please :) First, ask the user to enter a year (4-digit) and what week day...

    c++ please :) First, ask the user to enter a year (4-digit) and what week day does this year starts with (String) For example, the year 2018 starts with the week day "Friday". In this case, the calendar should start from January 1 which is Friday, 2018 Your program should produce a formatted calendar for the specified year and there should be a blank line after each month. Moreover, the month and the year should be centered over each month....

  • Questin 1 (CO 2) Which of the following is not a valid name in python? last_name...

    Questin 1 (CO 2) Which of the following is not a valid name in python? last_name lastName last name lname Question 2 (CO 3) How many times will “Hello World” be displayed after the following code executes? num=2 while num<12:     print("Hello world")     num+=2 2 12 5 4 Question 3 (CO 1) The following code contains an error, what type of error is it and what line number is it? 1 count=1 2 while count<4 3    print("count = ",...

  • Having trouble with the do while/while loop and the switch statement. I got some of the...

    Having trouble with the do while/while loop and the switch statement. I got some of the switch statement but cant get the program to repeat itself like it should.What i have so far for my code is below. Any help is appreciated... i am not sure what I am doing wrong or what i am missing. I am completely lost on the while loop and where and how to use it in this scenario. import java.util.Scanner; public class sampleforchegg {...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

  • I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For...

    I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For Loop) Logic Technical College has a current tuition of $10,000 per year. Tuition is scheduled to increase by 5% each year. Using a FOR loop, design a program that calculates and displays the tuition each year for the next ten years, like so: The tuition for year 1 will be: 10500.00 The tuition for year 2 will be: 11025.00 ……….. (You, of course will...

  • Write a program that will predict the size of a population of organisms. The program should...

    Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. For example, a population might begin with two organisms, have an average daily increase of 50 percent, and will be allowed to multiply for seven days. The program should use a loop to display the size of the population for each...

  • NOTE: LANGUAGE IS PYTHON CS160 Computer Science Lab 17 Objectives Work with dictionaries Work with functions...

    NOTE: LANGUAGE IS PYTHON CS160 Computer Science Lab 17 Objectives Work with dictionaries Work with functions Work with files Overview This lab will have you store the birthdays for a group of people. This program will store the information with the focus on the date of the month and not on the individual. The point of this program is to be able to see who has a birthday on a given day or to create a table of birthdays, in...

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