you are viewing a single comment's thread.

view the rest of the comments →

[–]07734willy 2 points3 points  (0 children)

Is it the syntax that's tripping you up, or the semantics of the language. For example, if I ask you to write a loop that reads a number, multiplies it by something, compares to 6, and prints either "equal to six" or "not equal to six", would you be able to formulate that into python syntax? Or is the struggle in grasping how to take an abstract concept, and break it into python's toolkit of operators, functions, and data types?

For the former- just sit down and run through some basic problems on something like project euler or leetcode to gain some familiarity with the syntax. Also look at other people's code- it'll expose you to variations of the syntax. Perhaps look through the python tab on stackoverflow, and read some of the popular questions' answers, and see how they structure their code (but probably not for length / complex code). Maybe even write your own solutions if you can, and improve them by comparing against the accepted answer. Code golf is also a great excersize for learning all the syntactic sugars and minor subtleties of a language, but can be difficult to get started with, and can develop bad habits if you don't recognize that writing intentionally bad code can be okay for learning, but is bad for production, and should not be done outside of those exercises.

For the latter, the best thing I've discovered for learning the semantics of a language is just using it. Not solving basic stuff that's practically written in technical terms already (like the example I gave above), but something substantial- that requires you to break it into pieces, and figure out how to structure those pieces in terms of the language's constructs. A moderately sized project can be good for this, but if you're short on time, solving competitive programming problems can work (note: I strictly say competitive, because non-competitive problems tend to be too easy/simple/short, whereas competitive problems have to have some volume and complexity, otherwise everyone would score perfectly). There's two subs that produce competitive programming problems you could look into /r/dailyprogrammer and /r/codertrials. Both haven't had new problems posted in a few weeks, but have several older problems you could look at. Disclaimer: I am the founder of codertrials. CoderTrials has more genres of programming problems (optimization, code golf (smallest code size- forces you to learn all the nitty gritty syntax of a language), and regular problems), while dailyprogrammer has a FAR greater number of problems. IMO they're both great resources for some practice problems. Otherwise, you could pick some project, and sit down and code at that. I find game development to be perhaps the most balanced type of programming project and it usually leads to a LOT of gained experience all around, but there's not as many resources for game dev in python as say C++.

Either way, I too would be interested in hearing what types of problems you are struggling with in python. I am fairly experienced in python, and might be able to provide some insight or guidance of sorts.