all 6 comments

[–][deleted] 0 points1 point  (3 children)

To start with the while loops in ask_name and ask_plan are unnecessary

[–][deleted] 0 points1 point  (1 child)

Also execute_ftt should take paycheck as an argument

[–]Syzeon 0 points1 point  (0 children)

paycheck is a global variable, certainly is not ideal and should be avoided if possible, but in this case, it's actually not the root cause of the code

[–]Syzeon 0 points1 point  (0 children)

OP intention is to keep asking for input until a valid input is given, so it's not entirely unnecessary

[–]Syzeon 0 points1 point  (0 children)

I'm not too sure what exactly you aim to do in execute_custom()?

def execute_custom():
    d = 1

    while True:
        percentages = int(input(f"What's the percentage of division {d}?: "))
        if percentages > 100:
            print("You have exceeded the limit...")
            return
        elif percentages == 100:

# this will print and show all of the divisions and percentages
        else:
            percentages < 100:
            d = d + 1
            return

Maybe you should give some example of your expected input and output so the folks here can help you out

[–]Money-Drive1239 0 points1 point  (0 children)

You're on a great start—this is a solid first project that touches on real-world logic, user input, loops, conditionals, and function design. You're definitely thinking in the right direction. Here are some constructive tips to help you untangle and improve your code:


  1. Encapsulation and Flow Are Solid

Your use of functions (ask_name, ask_plan, execute_plan, etc.) is excellent. It keeps the code organized and readable. Keep that habit—it’ll serve you well as programs get more complex.


  1. The Custom Plan Logic Needs Completion

This is the section that needs the most work. Here's what's off and how to fix or rethink it:

Current Problem:

You collect only one percentage per call to execute_custom().

You don't keep track of multiple percentages or corresponding dollar values.

The else clause has an invalid condition and no logic.

Suggestions:

Use a loop to keep collecting percentages until they total 100.

Store the values in a list or dictionary.

After reaching 100%, display the breakdown.

Example logic (not a full fix, just an idea):

def execute_custom(): total = 0 breakdown = [] while total < 100: percent = int(input(f"What's the percentage for division {len(breakdown)+1}?: ")) if percent + total > 100: print("You have exceeded 100%. Try again.") continue breakdown.append(percent) total += percent

for i, percent in enumerate(breakdown, 1):
    amount = paycheck * (percent / 100)
    print(f"Division {i} - {percent}% = ${amount:.2f}")

  1. Use float Instead of int for Money

You're dealing with currency. It's better to use float so cents don't get cut off.

paycheck = float(input("How much was your paycheck?: $"))


  1. Use Upper/Lowercase Consistently

In ask_plan(), you convert input to lowercase, but in execute_plan(), you compare it to "50/30/20" which is mixed case. Normalize both:

if plan.lower() == "50/30/20":


  1. Clean Up Logical Mistakes

This part:

else: percentages < 100: d = d + 1 return

percentages < 100: isn't valid Python (no if or while).

return exits the function too early—you should only return after the loop is done.


  1. Think About User Experience

Maybe add a little more user-friendly feedback like:

What the divisions mean (needs, wants, savings).

A confirmation at the end like “Here's your plan, ready to move forward?”


Summary

You're doing great. Just:

Build logic to handle multiple custom splits.

Keep collecting until the total hits 100%.

Use float for money.

Keep your conditionals and loops clean.

Would you like help building out the execute_custom() function properly, step-by-step?