Case scenario

Recruiters from other companies in the area have noticed your skill set on LinkedIn and through word of mouth from senior management. You’ve decided to leave your previous company and take a promotion at Staples Depot, an office supply store. Management there hired you because of your experience with modifying SKUs. Your goal is to use your knowledge of Python functions to organize your code so that incoming interns can follow along with what you’re doing.

What your Python program should do

Create a new repl for this lab. Do not reuse a repl from a previous lab or class activity.

Ask the user to enter the product name. The user can also enter ‘x’ (without quotes) to quit.

Ask the user to enter the product’s category.

Ask the user to enter the product’s price.

The whole program should loop until the user enters ‘x’ to quit at the product name entry.

You do not need to show this original information to the user.

Create a function called newsku

This function should take the product name and category as parameters.

If the category is ‘tech’, return a string that contains the first three letters of the product name in all caps.

If the category is ‘office’, return a string that contains the last three letters of the product name in all caps.

If the category is anything else, return the original product name in all caps.

Do not print anything from inside this function. This function needs to return a value.

Create a function called newprice

This function should take the product price as a parameter.

Increase the price by 10%. Return this new price.

Do not print anything from inside this function. This function needs to return a value.

Outside of your functions in the main block of code

You must call newsku() and pass in the product name and category. Remember to store the return value.

You must call newprice() and pass in the product price. Remember to store the return value.

Display this new information to the user.

After you display this information to the user, ask the user again for a product name or ‘x’ to quit. Keep running your program until the user types in ‘x’ as the product name.

Assumptions

You can assume that the length of the original product name will be more than three characters.

Your program should keep running until the user types in ‘x’ as the product name.

Price can contain decimals.

It’s ok if you have the .00000000000001 like in my output.

Sample output

This is from one continuous run of the program. I copied my text from the black area.

Please enter a product name. You can also enter x to quit: laptop

Please enter the product's category: tech

Please enter the product's price: 100

The new SKU is LAP and the new price is 110.00000000000001

Please enter a product name. You can also enter x to quit: scantron

Please enter the product's category: office

Please enter the product's price: .75

The new SKU is RON and the new price is 0.8250000000000001

Please enter a product name. You can also enter x to quit: whiteboard cleaner

Please enter the product's category: other

Please enter the product's price: 8

The new SKU is WHITEBOARD CLEANER and the new price is 8.8

Please enter a product name. You can also enter x to quit: x

Say hi to your TA!