+ 1
Ballpark order
I have approached this code coach from several different ways. They all pass except test 4. Does anyone have any thoughts or suggestions. 1 approach was list, for loops another was dictionary and for loops. Seems like I’m overthinking this
5 ответов
+ 5
I'd use a dictionary to store all available options as the key and their price as the value.
Then use a variable to store the total before tax.
Loop over the 4 input items (split into a list).
In the loop check if the item is in the dictionary and if so add its value to the total. If not add the value of a coke to the total.
Then calculate the tax for the total and add it to the total for output. Make sure the output format matches having 2 places after the decimal.
+ 2
Thank you for the help, added the format, had the rest. Still fails test 4. Will continue to solve this challenge
+ 2
solved, took another look and found that i misspelled Nachos in the dictionary, thanks again
+ 1
@ChaoticDawg thanks so much for your comment. You helped me figure out what I was missing (a check for items not on the menu)!
0
can you please send me the problem statement for this