Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
def shop_from_grocery_list(budget, grocery_list, *products_and_prices): bought_products = [] for product, price in products_and_prices: if product not in grocery_list: continue if budget - float(price) < 0: break else: bought_products.append(product) grocery_list.remove(product) budget -= float(price) if not grocery_list: return f"Shopping is successful. Remaining budget: {budget:.2f}." else: return f"You did not buy all the products. Missing products: {', '.join(grocery_list)}."
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)