f | def function_that_says_ni(*args, **kwargs): | f | def function_that_says_ni(*args, **kwargs): |
| | | |
t | price_of_shrubbery = 0.00 | t | price_of_shrubbery = 0 |
| unique_letter = set() | | unique_letter = set() |
| | | |
| for shrub in args: | | for shrub in args: |
| if isinstance(shrub, dict) and "name" in shrub and shrub["name"].lower() in {"храст", "shrub", "bush"}: | | if isinstance(shrub, dict) and "name" in shrub and shrub["name"].lower() in {"храст", "shrub", "bush"}: |
| if "cost" in shrub and isinstance(shrub["cost"], (int, float)): | | if "cost" in shrub and isinstance(shrub["cost"], (int, float)): |
| price_of_shrubbery += shrub["cost"] | | price_of_shrubbery += shrub["cost"] |
| | | |
| | | |
| for key, shrub in kwargs.items(): | | for key, shrub in kwargs.items(): |
| if isinstance(shrub, dict) and "name" in shrub and shrub["name"].lower() in {"храст", "shrub", "bush"}: | | if isinstance(shrub, dict) and "name" in shrub and shrub["name"].lower() in {"храст", "shrub", "bush"}: |
| if "cost" in shrub and isinstance(shrub["cost"], (int, float)): | | if "cost" in shrub and isinstance(shrub["cost"], (int, float)): |
| price_of_shrubbery += shrub["cost"] | | price_of_shrubbery += shrub["cost"] |
| unique_letter.update(key) | | unique_letter.update(key) |
| | | |
| if price_of_shrubbery > 42.00: | | if price_of_shrubbery > 42.00: |
| return "Ni!" | | return "Ni!" |
| | | |
| if int(price_of_shrubbery) == 0 or len(unique_letter) % int(price_of_shrubbery) != 0: | | if int(price_of_shrubbery) == 0 or len(unique_letter) % int(price_of_shrubbery) != 0: |
| return "Ni!" | | return "Ni!" |
| | | |
| return f"{price_of_shrubbery:.2f}лв" | | return f"{price_of_shrubbery:.2f}лв" |