Last active
April 26, 2025 06:32
-
-
Save murxg/5b38bfa432905bc2224e2270bbc25f04 to your computer and use it in GitHub Desktop.
Calculating how many cases you can open with your budget :P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GREEN = "\033[38;5;150m" | |
RESET = "\033[0m" | |
budget = float(input(f"{RESET}╭{GREEN} Budget: {RESET}")) | |
key = float(input(f"{RESET}├{GREEN} Key price: {RESET}")) | |
case = float(input(f"{RESET}╰{GREEN} Case price: {RESET}")) | |
combocost = case + key | |
openamount = budget // combocost | |
openamount_message = f" {RESET}Amount of cases you can open: {GREEN}{int(openamount)}{RESET} " | |
leftover = budget - (combocost * openamount) | |
leftover = round(leftover, 2) | |
leftover_message = f" {RESET}Money left: {GREEN}{leftover}{RESET} " | |
max_length = max(len(openamount_message), len(leftover_message)) | |
top_line = f"╭─ {GREEN}Result{RESET} " + "─" * ((max_length - 9) - 19) + "╮" | |
bottom_line = "╰" + "─" * (max_length - 19) + "╯" | |
print(top_line) | |
print(f"│{openamount_message}{' ' * (max_length - len(openamount_message))}│") | |
print(f"│{leftover_message}{' ' * (max_length - len(leftover_message))}│") | |
print(bottom_line) |
Author
murxg
commented
Dec 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment