Skip to content

Commit

Permalink
use range validator w unbounded floats #42 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
blahosyl committed Apr 17, 2024
1 parent d670ed4 commit 7b3b5ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pantry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# for each item on the shopping list
for i in range(0, len(shopping_list.list_data)):
# ask how much the user has
have = float(input(f"How much {shopping_list.list_data[i][0]} do you have?"))
text = [f'How much {shopping_list.list_data[i][0]} do you have? ']
have = planner.validate_number_range(text, float, 0)
# deduct the quantity in the pantry from the quantity on the shopping list
shopping_list.list_data[i][1] -= have
# if the resulting quantity is more than 0
Expand Down

0 comments on commit 7b3b5ee

Please sign in to comment.