cs50 / problems

Checks for check50
142 stars 234 forks source link

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

Open kguryanov opened 2 months ago

kguryanov commented 2 months ago

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](https://github.com/user-attachments/assets/f9183fad-8100-44d0-b3fc-5be189c82a04)

3. 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. <ins>**Ignore any input that isn’t an item**</ins>. 
3. Demo showcases the reprompt on incorrect input:
![image](https://github.com/user-attachments/assets/0b8c66e1-8e24-479e-b953-0e123f808b3e)

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](https://github.com/user-attachments/assets/bda98915-62bd-4589-917b-92a198b22b1a)
2. test `:) input of "burger" results in reprompt` passes validation