Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kguryanov opened this issue Aug 11, 2024 · 0 comments

Comments

@kguryanov
Copy link

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 kguryanov changed the title CS50P Problem Set 3 - taqueria - check50 doe not catch missing reprompt for item not in the menu CS50P Problem Set 3 - taqueria - check50 does not catch missing reprompt for item not in the menu Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant