PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - (gpt-5.6)
Token size
4,784
Example input
[DELETE THIS TEXT AND PASTE YOUR BRIEF: TASK: describe the small project you want: what it does, what it takes as input, what it should output, and any rule it must follow β€” ideally 10 words or more. Do not include names of individuals, companies, or products, confidential data, or secrets. Language: optional, Python by default or JavaScript. Leave blank for Python. Acceptance checks: optional, one to five sample inputs in words with the expected results. Leave blank and the tool writes them. Allowed libraries: optional, names of widely known libraries. Leave blank for the standard library only.]: TASK: A command-line program that reads a text file of monthly bills, one bill per line with a name and an amount, adds up the amounts for each name, and prints the totals from largest to smallest with the grand total at the bottom. Language: Python Acceptance checks: 1) A file with Rent,900 and Internet,40 and Rent,900 prints Rent 1800.00 first, then Internet 40.00, then Grand total 1840.00. 2) An empty file prints a clear error message.
Example output
MODE: Standalone Reply 1 of 5 Β· Part 1 of 3 Future Code Project Maker situation: Monthly bill aggregation command-line program πŸ” Detected: Language Python, project monthly bill totals calculator, gaps K8 User Experience, K10 Detail Depth, defaults chosen for command-line arguments, input validation, amount formatting, descending sorting ──────────────────── πŸ—ΊοΈ PROJECT MAP: Project name: Monthly Bill Totals What it does: Reads a text file containing bill names and amounts, combines amounts belonging to the same name, and prints the results from largest to smallest. Displays the grand total at the bottom and reports an error when the input file is empty or invalid. Files: * main.py: Command-line controller, arrives in Part 1 * bill_totals.py: File reading, validation, aggregation and sorting, arrives in Part 1 * report.py: Output formatting and report generation, arrives in Part 2 Parts: * Part 1: Basic file reading, bill aggregation, sorting and grand total. * Part 2: Separate report-formatting module. * Part 3: Additional input validation and clearer error reporting. β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ 🟒 PART 1: Read bills, combine duplicate names and print totals. How to run: python3 main.py bills.txt Example input file: bills.txt ```text Rent,900 Internet,40 Rent,900 ``` β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ πŸ’» CODE β€” save as main.py: ```python import sys from bill_totals import calculate_totals def main(): if len(sys.argv) != 2: print("Error: Provide one input filename.") return 1 filename = sys.argv[1] try: totals, grand_total = calculate_totals(filename) for name, amount in totals: print(f"{name} {amount:.2f}") print(f"Grand total {grand_total:.2f}") return 0 except (ValueError, OSError) as error: print(f"Error: {error}") return 1 if __name__ == "__main__": sys.exit(main()) ``` πŸ’» CODE β€” save as bill_totals.py: ```python def calculate_totals(filename): totals = {} with open(filename, "r", encoding="utf-8") as file: lines = file.readlines() if not lines or not any(line.strip() for line in lines): raise ValueError("The input file is empty.") for line_number, line in enumerate(lines, start=1): if not line.strip(): continue parts = line.strip().rsplit(",", 1) if len(parts) != 2: raise ValueError( f"Invalid format on line {line_number}." ) name = parts[0].strip() if not name: raise ValueError( f"Missing bill name on line {line_number}." ) try: amount = float(parts[1].strip()) except ValueError: raise ValueError( f"Invalid amount on line {line_number}." ) if amount < 0: raise ValueError( f"Negative amount on line {line_number}." ) totals[name] = totals.get(name, 0.0) + amount if not totals: raise ValueError("No valid bills found.") grand_total = sum(totals.values()) sorted_totals = sorted( totals.items(), key=lambda item: item[1], reverse=True ) return sorted_totals, grand_total ``` β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ βœ… ACCEPTANCE CHECKS β€” run these yourself: a. Input file containing Rent,900, Internet,40 and Rent,900. Expected result: Rent 1800.00 first, Internet 40.00 second, Grand total 1840.00 last. b. An empty input file. Expected result: Error: The input file is empty. c. Input file containing Electricity,75 and Water,25. Expected result: Electricity 75.00, Water 25.00, Grand total 100.00. d. Input file containing Internet,invalid. Expected result: A clear invalid amount error identifying line 1. ──────────────────── ℹ️ "This tool writes the code of a small project from your brief, one part at a time; it does not run or test it, choose for you, state working, security, performance, cost, market, legal, or feasibility conclusions, or predict how the code or an assistant will turn out. Run the acceptance checks and review the code yourself before relying on it." Assumptions made: * Input format: Each bill uses the format name,amount, with a comma separator. * Command-line usage: The filename is supplied as the first command-line argument. * Sorting: Bills with equal totals retain their original insertion order. * Validation: Blank lines are ignored; malformed entries, negative amounts and invalid numbers produce errors. ❓ Want the next part or a change? Reply "next:" for the next part, or "change:" followed by one request to revise this part. πŸ’‘ Go deeper: search "Future Function Finder" on PromptBase for what the software does, or "Future Innovation Finder" to test its idea. For one small program in one file, search "Future Code Maker". βš™οΈ "Built for ChatGPT; other AI models, providers, and versions are untested. Use at your own discretion. This tool is not intended as a sole safeguard against attempts to alter its behavior, nor as a substitute for professional legal, financial, and subject-matter advice before acting on its output."
GPT

Future Code Project Maker

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Tested icon
Guide icon
4 examples icon
Free credits icon
πŸ’» Describe a small project in plain language and get 3-5 Python or JavaScript files in 3 parts, easy to copy: project map, how to run, code, and 3-5 acceptance checks you run yourself. Part 1 already prints a real result. Gaps are filled with listed simple defaults. Revise with changes, up to 5 replies. ⚠️ Not engineering, code-review, legal, or security advice; code is not run or tested; no working or security claims; not liable for outcomes. Tested on ChatGPT; other models untested.
...more
Added 5 hours ago
Report
Browse Marketplace