u/Critical_Tomorrow959

Homework help with Java program

working on a Java program that tracks parts completed each month until either 10000 parts are reached or 24 months pass. The logic itself is working but the math output is coming out slightly off.

After three months my result is showing:

1191.0160000000003

But the expected result should be:

1191.0159999999998

The line I have inside the for loop is parts Num *= 1.06;

and I can't figure out what's missing or needs to be adjusted to match the correct output.

Let me know if I need to share more of the code.

thanks

reddit.com

Why is my dictionary only keeping the last item instead of grouping all values together?

So I have been working on this for a while and i am pretty stuck. I am building a function that is supposed to take a list of dictionaries and group them by a key value. Everything looks right to me but the output is completely wrong and I cannot figure out why.

Here is my code:

def group_by_key(data, key):
    result = {}
    for item in data:
        group = item[key]
        result[group] = item
    return result

students = [
    {"name": "Marcus", "major": "CS"},
    {"name": "Jordan", "major": "Math"},
    {"name": "Tyler", "major": "CS"},
    {"name": "Aisha", "major": "Math"},
]

print(group_by_key(students, "major"))

What I expected:

{
  "CS": [{"name": "Marcus", "major": "CS"}, {"name": "Tyler", "major": "CS"}],
  "Math": [{"name": "Jordan", "major": "Math"}, {"name": "Aisha", "major": "Math"}]
}

What I am actually getting:

{
  "CS": {"name": "Tyler", "major": "CS"},
  "Math": {"name": "Aisha", "major": "Math"}
}

So it is only keeping the last item for each group instead of collecting all of them. I think the issue is somewhere in how I am assigning to the dictionary inside the loop but I am not sure how to fix the logic without breaking the whole structure.

I have tried checking if the key already exists before assigning but I could not get it to work properly. Can someone explain what is going wrong conceptually so I actually understand it rather than just patching it....................?

reddit.com
u/Critical_Tomorrow959 — 4 days ago

So I have been learning from 5 months. I know HTML, CSS, JavaScript, and I m knee-deep in React. I can build stuff. Ugly stuff, but stuff meanwhile every Youtube guru is out here promising "get hired in 90 days", and I am sitting here like - buddy, I still google how to center a div.

Then I open a job posting and it wants 3 years of experience, React, Vue, Angular, AWS, Docker, a PhD, and the ability to communicate with dolphins. ha ha ha.

For anyone who actually got hired - genuinely asking-

  1. How long did it take you, for real?
  2. Were you still a complete mess when you applied or did you actually feel ready?
  3. What was the thing that finally got you in the door?
reddit.com
u/Critical_Tomorrow959 — 10 days ago

I am 22 self-teaching through free online resources and building small projects on the side. No degree. Genuinely curious - do employers still filter out resumes without a CS degree, or does a solid portfolio carry enough weight now?

For anyone self-taught and currently employed, what actually got you the interview? GitHub, networking, referrals?

Would love to hear from people who have gone through hiring recently not just general opinions

reddit.com
u/Critical_Tomorrow959 — 12 days ago

Close the tutorial and just build something. Being stuck is the lesson — not watching someone else avoid it.

Build stuff you had actually use. 

Break other people's code on purpose. Fix it. You'll learn more in an hour than a week of tutorials.

Read the error messages. They're telling you exactly what's wrong.

1-2 Codewars problems a day Consistency beats weekend grinding every time.

Post your code and ask for feedback. "What would you do differently?" gets way better answers than "does this work?"

reddit.com
u/Critical_Tomorrow959 — 12 days ago

Need attention everyone,

I’m in week 2 of learning Python and just hit my first “real” assignment. It involves loops, tracking values, averages, and using if/else conditions.

I get the basics, but I don’t know how to approach building the program step by step.

What is the best way to break something like this down? Would appreciate any advice?

reddit.com
u/Critical_Tomorrow959 — 13 days ago

I have been going back and forth on this for a while and could really use some honest input.

Every time I get motivated to start learning coding (Python, web dev, etc), I end up seeing content about AI replacing developers soon. Tools like GitHub Copilot, Cursor, and Claude can already generate working code from simple prompts, which makes me wonder — what is the point of spending months learning the basics?

At the same time, I keep thinking:

Maybe it still matters because someone needs to guide the AI, review its output, and understand what’s going on Or maybe it doesnot, if AI keeps improving to the point where even that isn’t needed I am not trying to be dramatic - I just want to make a smart decision about where to invest my time going into 2026.

If you are already a developer or currently learning:

Do programming fundamentals still matter?

Has AI changed how you work, or actually reduced the need for developers?

What would you honestly recommend to someone starting from zero today?

No hype or doom takes - just real experiences. What do you think?

reddit.com
u/Critical_Tomorrow959 — 26 days ago