problems icon indicating copy to clipboard operation
problems copied to clipboard

CS50P Problem Set 3 - taqueria - check50 does not catch missing reprompt for item not in the menu

Open kguryanov opened this issue 6 months ago • 0 comments

Preconditions

  1. Have a taqueria.py, which prints "Total: ..." when user enters item not in the menu:
CONST_USER_PROMPT = "Item: "
CONST_MENU = {
    "Baja Taco": 4.25,
    "Burrito": 7.50,
    "Bowl": 8.50,
    "Nachos": 11.00,
    "Quesadilla": 8.50,
    "Super Burrito": 8.50,
    "Super Quesadilla": 9.50,
    "Taco": 3.00,
    "Tortilla Salad": 8.00,
}


def main() -> None:
    total = 0
    while True:
        try:
            order = input(CONST_USER_PROMPT).strip()
            total += CONST_MENU.get(order.title(), 0)
            print(f"Total: ${total:.2f}")
        except EOFError:
            print()
            break


if __name__ == "__main__":
    main()

Steps to reproduce:

  1. Run python taqueria.py

  2. Enter the following items:

    • Burrito
    • not in the menu
    • burger
  3. Output: image

  4. Run check50 cs50/problems/2022/python/taqueria

Expected result:

  1. check50 should fail the validation

  2. The description for the assignment contains the following:

    After each inputted item, display the total cost of all items inputted thus far, prefixed with a dollar sign ($) and formatted to two decimal places. Treat the user’s input case insensitively. Ignore any input that isn’t an item.

  3. Demo showcases the reprompt on incorrect input: image

  4. The "How to test" section has the following:

    Run your program with python taqueria.py. Type Burger and press Enter. Your program should reprompt the user.

Actual result:

  1. check50 passes the code image
  2. test :) input of "burger" results in reprompt passes validation

kguryanov avatar Aug 11 '24 09:08 kguryanov