Lab 4: Shopping lists
Python实验代写 One of the components of BUS 101 is to practice learning material on your own. As you’ll see throughout the quarter,
One of the components of BUS 101 is to practice learning material on your own. As you’ll see throughout the quarter, it’s not possible to learn everything about IS in 10 weeks. I want you to get in the habit of using your allowed resources and practicing learning on your own. You’ll have to learn new material on your own when you get into industry.
Cheat sheets
How to find the length of a string
How to print a quotation mark (read the ##Quotes and A postrophes section near the top)
Case scenario
Scotty Highlander and his friend Peter Anteater are roommates. This week, it’s Scotty’s turn to do the grocery shopping for both of them. He needs your help in making two shopping lists—one for him and one for Peter. For some weird reason, Peter always wants the same things that Scotty wants, and then a few extra items. Scotty needs a list of things to buy for himself and another list of things to buy for Peter.
What your Python program should do Python实验代写
Create a new repl for this lab. Do not reuse a repl from a previous lab or class activity.
Scotty will go first
Let Scotty (i.e., the user) enter something to buy, one by one, until he types in ‘x’ (without quotes).
Store each item in a list called scotty.
Next, it’s Peter’s turn
Without quitting your program, Peter (i.e., the same user) will enter items that he wants to buy.
Peter’s list should be called peter.
It should contain everything from Scotty’s list, plus the extra items that Peter wants.
When Peter is done with his list, he should be able to type ‘x’ (without quotes) to tell your program that he is done adding things.
Print the lists and extra information
Print each item in Scotty’s list, one by one, each one on a new line. You will not earn full credit if you just print the scotty variable.
Print each item in Peter’s list, one by one, each one on a new line. You will not earn full credit if you just print the peter variable.
Find the longest item name in Scotty’s list and tell him what it is.
Find the shortest item name in Peter’s list and tell him what it is.
Assumptions Python实验代写
- Your TA will not type ‘x’ as the first item.
- No items will have the same length.
Sample output
Each output below is from one run of the program. I copied my text from the black area.
Hi Scotty, what do you need at the store? Enter item or x to quit: aaa Enter item or x to quit: bbbb Enter item or x to quit: ccccc Enter item or x to quit: x Thanks Scotty. Your turn, Peter! Enter item or x to quit: dd Enter item or x to quit: eeeeeeeeee Enter item or x to quit: x Scotty's list: aaa bbbb ccccc Peter's list: aaa bbbb ccccc dd eeeeeeeeee Scotty's longest item is: ccccc Peter's shortest item is: dd Hi Scotty, what do you need at the store? Enter item or x to quit: macaroni Enter item or x to quit: egg Enter item or x to quit: cheese Enter item or x to quit: x Thanks Scotty. Your turn, Peter! Enter item or x to quit: sauce Enter item or x to quit: x Scotty's list: macaroni egg cheese Peter's list: macaroni egg cheese sauce Scotty's longest item is: macaroni Peter's shortest item is: egg
Prof. Rich note: it doesn’t matter that ‘egg’ was entered by Scotty because Peter’s list starts with the same items that Scotty has. Peter then adds extra items to his list only.
How to submit your Python code
When you are done with your code, click into your browser’s address bar and copy that entire link.
Submit this link in your discussion eLearn.
Grading rubric Python实验代写
100 points total.
Listed below are the test cases your TA will use with your program. Each test case is denoted by a letter. For the given input, your program’s output should match the output below. Test case letters with a number after it denote an error and how much each error is worth.
Important note: do not specifically look for the values below. Your TA should be able to enter any valid input and your program should work organically.
Hardcoding
H -20: deduction if your TA notices any hardcoding
Test case (only one)
Scotty’s list
laptop
typewriter
book
Peter’s additional items
phone
scantrons
Output
Scotty’s list:
laptop
typewriter
book
Peter’s list:
laptop
typewriter
book
phone
scantrons
The longest item in Scotty’s list is: typewriter
The shortest item in Peter’s list is: book
J -10: Scotty’s list is not complete OR not printed one by one on a new line
K -10: Peter’s list is not complete OR not printed one by one on a new line
L -10: Scotty’s longest item is not correct
M -10: Peter’s shortest item is not correct
If you submit a program that either:
a. Doesn’t run
b. Runs but misses all the test cases
You will earn a 60 out of 100.
Blank files will earn a 0. Invalid links will be subject to the invalid link penalty described in the syllabus.
更多代写:计算机加拿大网课代考代上 线上考试 英国Law代写 多伦多经济essay代写 北美paper作业代做 代写Web