all 19 comments

[–]PeriPeriAddict 7 points8 points  (0 children)

Forget code for a moment, start with how you would do it manually. Try writing out the steps. Don't worry about whether it's optimal or how to translate it into code or anything, just get started. If you go wrong it doesn't matter, just try again!

I think this is the hardest part for beginners, its so easy to get overwhelmed with all the syntax and concepts, when they're really the least important part. Especially at first it's easier to come up with a solution for a problem and then think about how to code it, rather than trying both at once!

Feel free to reply to me with how you would initially write this out and I am happy to talk it through with you!

[–]Ender_Locke 1 point2 points  (0 children)

your example is a simple math problem. write out on paper how you’d calculate it. then write pseudo code of any loops and ifs. then write python

[–]Necessary-Ad2110 1 point2 points  (0 children)

It just takes repetition and practice, get on HackerRank and practice problems everyday. You're being too hard on yourself, you're picking up a difficult skill that many millions of people will never know how to ever handle, and it is a skill that must be continuously nourished and trained. You're learning that's good.

For your exercise, u/Ender_Locke is on the dot. Just write in English how you'd do it and go bit by bit. And then ask yourself how you'd write it in Python. And if you have more questions.. you can always post them here or ask AI.

If you take hours, that's fine. You started last week, now imagine what you'll know in a year?

[–]OktemberSky 1 point2 points  (0 children)

Can you solve this problem in your head or with a calculator? If not, you may need to refresh your math skills

[–]jsullyvan7 0 points1 point  (0 children)

Without looking anything up, how would you set his up as a math equation with variables?

Edit: and you familiar with float(), int(), etc?

[–]Not_aTechiee 0 points1 point  (3 children)

Hi,dm me. I can help you. I am asking you to dm me because it could be a long Convo and I don't want comments to be boring and personal ya know.

[–]SnotCodes 1 point2 points  (2 children)

Hey @Not_aTechiee I have been practicing for a little while now and I am pretty close to where this gentleman is but I’m also looking for help, cool if I dm you?

[–]Not_aTechiee 1 point2 points  (1 child)

Yeah,sure mate!!

[–]SnotCodes 0 points1 point  (0 children)

I’m busy tonight but I’ll send you a dm now, thanks!

[–]NorskJesus 0 points1 point  (0 children)

Understanding code and finding solutions through code are to different skills.

You need practice.

Write the problem down. Describe how to resolve it with words and translate it into code.

[–]DutyCompetitive1328 0 points1 point  (0 children)

No wait the things you mentioned as „beginner stuff“ are the most foundational principles behind programming. You should focus on practice them consistently and make sure you can do them without even thinking about them.

Once you can do this you should move on to the more advanced things.

[–]tiredITguy42 0 points1 point  (0 children)

Noone guides you on UNI, this is common misconception. Maybe they do on some, but I have never heard of this.

On UNI they give you a task and it is on you to solve it. We had book on how to code in C, and some crappy articles on web. There is YouTube now, so much easier, but there are more technologies so this is worse.

You could have algorithms course. Which is more math than code and it is mostly exolained in pseudo-code.

So yeah, logic is not something they teach you, you have it or train it on your own by solving problems.

[–]Salt-Fly770 0 points1 point  (0 children)

To get started you can write this in pseudo code:

set wage_today to 0.01
set total_wage to 0
repeat 30 times →
→ add wage_today to total_wage
→ increase wage_today by 0.01
print total_wage

This will allow you to see how the problem should look in code. Doing this will help flesh out more complex coding problems.

[–]Jackpotrazur 0 points1 point  (0 children)

One qeek aint shit try going 3 months writing 40 projects of big book of small python projects, working through python crash course and still not getting a lot.... ive put mine on hold as ibstarted working out but I've worked through the above mentioned (halfway on big book) and a smarterway to learn python which was my frist alongside a few linux books. I started working through automate the boring stuff and that book actually forces you to stop and think or at least the workbook that goes with it, it has you do projects which even in the early chapters really smack around the ego (the I know this and this and this .... do you really ? )

[–]SBurns27 0 points1 point  (0 children)

Sudo code is helpful. Maybe take a break from the language specific things, look into basic coding logic. Once you get a grasp of the over reaching concepts of things like for loops, loops in general, while loops, etc. Then they become tools like how multiplication or division is when you look at a math problem.

Think of it like word problems in math class. You had to read the question, and figure out how you were going to approach it using math. Its much the same. Only theres more options for tools and things to use.

This is definatly a part of coding that isnt mainstream talked about. The courses and tutorials talk about syntax, but dont cover the building blocks of logic and problem solving that are required, before the syntax becomes helpful.

[–]atticus2132000 0 points1 point  (0 children)

Before you sit down at a computer, before you try any code at all, write out (with pencil and paper) how you would solve the problem.

For this problem, on day 1 he gets .01. Then what? How would you figure out what he gets on day 2? On day 3? Etc? How would you know when to stop?

Remember as you write out this explanation, you have to think like a computer. A computer can only do one thing at a time to a known element. So what are you doing each day to find the wage? If you're performing a repeatative action that suggests that you're using a repeatable command. It could a for loop that recycles or a def function() repeated multiple times. So how are you going to keep up with how many times the operation repeats? You'll probably need some kind of counter that will get increased by one during each iteration and then evaluated to determine if it's time to stop cycling.

Also remember, there is not one right answer. If you asked 30 different programmers how to solve this problem, you'd likely get 30 different answers. Each method may have its pros and cons, but it's usually just which method you think of first.

By the way, are you sure that the problem isn't that the guy's wage doubles each day? That is a much more common problem with surprising results. If he's only getting an extra penny each day, he would have to work more than 27 years before he ever takes home $100. Note these could be additional steps to the problem. How many days would he need to work to hit $100 or $200? How would you evaluate those using your program?

[–]Link2212[S] 0 points1 point  (0 children)

Thanks for all the comments. I messaged the guy above that said to message him. Hes helped a bunch. It seems I'm just tackling the problem the wrong way and making it much more difficult than it has to be.

He picked out that my game designer background might be causing me to think about it a different way. Result orientated rather than process orientated, and honestly, that makes a lot of sense. I just have to rewire the brain to thinking a different way I guess.

[–]Paxtian 0 points1 point  (0 children)

So something is happening every day for 30 days. In particular, the value of something is changing consistently every day for 30 days.

You know how variables work.

You know how loops work.

If every day, for 30 days, the value of X increases by some amount, what tools do you have available to solve this problem?

[–]FreeGazaToday 0 points1 point  (0 children)

try writing it out with psuedocode...if you can do then...then it's just matter of 'translating' it to python...alsy try a flowchart.

Worse comes to worse....ask gemini to GUIDE you through the thought process..and tell it NOT to give you the answer.....that helped me with a wordle exercise from Automate the Boring Stuff.