+ 3
Does anyone have a good way of learning how to build your own algorithm in python?
I've been having issues putting together some sort of algorithm for any issue I'm trying to compute an answer for in python? So I was wondering if anyone has any suggestions on how to get better faster? And how to improve their critical thinking during coding?
13 Answers
+ 2
This is in fact not specific to python :) . With every programming language you need to be able to convert your specific problem into a form that can be solved by a computer - and that is before you write even your first line of code.
Unfortunately, there are no shortcuts for this. But practice helps - the more you work on this, and the more you see various algorithms being used in practice (a course or a book on algorithms really helps here), the more you will start to see patterns. And you will start to think "oh, this problem I'm having looks like a place where I can use algorithm X" :)
+ 4
Is the frustration normal? Haha I've been trying to build functions with loops and if statements recently (because that's where I'm up to) @Bogden
+ 3
The frustration is pretty normal in the firsts stages. I managed it thinking in python as a guy who does EXACTLY what you told him. For example, if I say "while you are in the street buy some cookies" mr Phyton is going to buy cookies forever once he goes out.
So, he is your friend, but a really weird one. Before write any line of code, make a global idea of it, write a abstract in a notepad and divide the big problem in a ton of little ones, and solve them one by one. Doing that I'm sure you'll overcome the difficulties. And if not, ask for help (only when you tried it!! ^^)
+ 3
@Hector94 thank you for the advice! Recently I've been writing things down and it's been helping. I'm actually taking intro to computer science this summer online from my college so I'm working to learn python through that.
+ 3
The frustration is absolutely, unequivocally normal. As children, we aren't learning our first language(s) with deadlines.
+ 2
If anyone learning any language has any suggestions that would also be great!
+ 2
Haha yeah I am working on it. I only started 2 weeks ago.
+ 2
Yeah that makes sense @Jacob. I've been trying to do some simple ones. Ive had a hard time understanding loops and stuff. Im thinking that the struggle is normal though
+ 1
Practice a lot.
Maybe start with a simpler problem and see how to solve that, and then answer harder ones.
+ 1
If you have exhausted your skill post code here and someone may/will give feedback
+ 1
look at my latest published code. just tap my chat pic
0
@Ava, I've posted a pendulum code for your todays 'exam' if you want an example of code to expand and make your own
0
@BaardHelmen what do you mean?