cs50python
cs50python copied to clipboard
My problem sets for CS50 Python 2022
the function convert(time) is supposed to convert inputs like 7:30 to 7.5 but returns 7.05. This is because minutes is divided by 600 essentially converting minuets into seconds. This also...
meal correct code def main(): time = input("Enter time: ") hours = convert(time) if 7
set0
indoor # indoor.py correct codes def main(): user_input = input("Please enter some text: ") print(user_input.lower()) if __name__ == "__main__": main() tip def main(): dollars = dollars_to_float(input("How much was the meal?...
test_fuel correct code import pytest from fuel import convert, gauge # Test cases for convert function def test_convert_valid_fraction(): assert convert("3/4") == 75 def test_convert_zero_division_error(): with pytest.raises(ZeroDivisionError): convert("1/0") def test_convert_value_error(): with...
taqueria correct def main(): 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 }...
coke correct code def main(): cost = 50 due = cost while due > 0: print(f'Amount Due: {due}') coin = int(input('Insert Coin: ')) if coin in [25, 10, 5]: due...
Made small edits to increase efficiency, added a few more test cases.