r/learnpython • u/Cheese-whiz-kalifa • Aug 23 '20
I can’t seem to “think like a programmer”
Been learning python for about two months. Read a few books. I can now do every single exercise in python crash course without referencing the book and have even tweaked many of the exercise programs. But I’m beginning to feel that “imposter syndrome” I keep hearing about.
The problem I’m having is when it comes to breaking down a problem into single step by step problems. Even making a tic tax toe game is a little difficult for me right now.
From my own learning and research I’ve come to realize I may need to learn more on algorithms.
From what I understand an algorithm is simply a step by step series of instructions to solve a problem. That’s at least the best way I can sum up the idea in my head. Is this correct? I’m sure there’s more to it than that. Forgive my ignorance. Trying to teach myself everything in quarantine with. I experience.
If I’m correct in my understanding of algorithms and pinpointing what area I need to hone next, can anyone recommend any good books or even videos that can help me overcome this problem and get better at being able to break a complex idea or problem down or have a better understanding of algorithms.
Please try to keep in mind I am a beginner when recommending books. I have a solid foundation of the basic fundamentals of python. Lists, dicta, loops, classes and the like but am trying to figure out how to use and apply that knowledge better.
145
u/Casssis Aug 23 '20
Practice will do.
What worked for me is I started with a book (the programmers apprentice or something) and I never finished it because I just started programming my own stuff cuz I wanted to make stuff. And ended learning a lot by practice, YouTube and the Internet in general.
Just keep on coding
33
u/luc1fersam Aug 23 '20
You are absolutely right. I can just add that the abillity to work and understand with official docs is one of the main points too.
18
u/cmcgarveyjr Aug 24 '20
Yeah, learning to read technical docs and cookbooks is pry one of the most invaluable skills a dev can learn.
67
Aug 23 '20
Do MIT opencourseware 6.006 the whole series of lectures is on youtube and it explains EXACTLY what algorithms are, computational complexity, data structures, dynamic programming, everything!
2
u/Bapi_Escrobar Aug 24 '20
Thanks for this, I was just getting into algorithm and data structures and it has me so confused. Hopefully this helps!
199
u/Asalanlir Aug 23 '20
This may be a time to just be brutally honest: you've barely started learning. Based on your wording, it seems you may be under the impression that, by two months, you should at least be starting the get the hang of it. Sorry, but no. It takes years to be able to break apart problems into their base parts. Even then, it's not a black and white "I've learned to do it." I've been programming for over a decade and I still am improving on structure, design, planning, etc. It's a skill. You've barely started, but you'll get better. Just keep at it.
As for "algorithms", that's actually pretty much the definition. It's a very broad concept, though it holds certain connotations based on the context. It's basically just a description of a process. As an analogy, an algorithm is a set of blueprints; The program is the building.
Personally, I've never found books to be an effective way of learning programming. They kind of work for computer science (I hold a particular hatred for theory). Think of a problem or project, and just keep hammering away at it. It will be objectively terrible. Iterate and improve on it. Figure out what you need in order to accomplish a task, and look up tutorials on how to do that thing.
tldr Just keep at it.
13
u/uspharaoh Aug 24 '20
This was a fantastic post thank you. I’m kinda in the same boat as OP after a few months and I’ve begun my first project and working on it. Getting discouraged often but I’m hammering away. Feels good to know effort is being placed in the right direction
8
u/WhatDaHellBobbyKaty Aug 24 '20
I am one of those people that has to have hands-on experience to learn. The more that I fix my mistakes, the more of it sticks in my brain. Check these sites that have thousands of problems to solve of all different levels. They are a lot of fun too.
3
u/demdillypickles Aug 24 '20
I would just add a little bit to this.
It’s easy for beginners to get overwhelmed because you keep hearing about these important concepts like “algorithms” and “Big O notation”. While these things are important, don’t worry about them yet. When you’re working for a real company, making a real product, that stuff will matter. Right now though, you just need to worry about learning your language of choice. Eventually you’ll learn how to use all the tools in your toolbox. Once you’ve learned your tools, then you can perfect your craft.
Also, don’t expect your code to be perfect the first time. In fact, you’ll learn more from having to fix your own broken code. Bugs are the best teachers.
0
Aug 23 '20
[deleted]
33
u/tangerinelion (C++ Software Eng.) Aug 24 '20
If people could gain a year of experience by reading for two days, a book like that would be worth $80,000 per copy.
0
Aug 24 '20
[deleted]
15
u/AngryGoose Aug 24 '20
It's said that it takes 10,000 hours of experience to really master something. A book can't give you that kind of experience.
0
Aug 24 '20
[deleted]
11
u/Naesme Aug 24 '20
You're wrong on every account.
Books can tell you things, but you're not gonna remember most of what you read. It's also not going to help you understand.
You can read a thousand mistakes programmers make, you'll remember about 100 of them if you're lucky, and you'll understand about 30.
You can't master material (and yes, people DO master things. Don't know where the fuck you got that idea from) from reading. You can be introduced to new things and learn from books, but you don't improve until you actually do something.
0
Aug 24 '20
[deleted]
4
u/MotionlessMatt Aug 24 '20 edited Aug 24 '20
Hey, everyone learns differently. No need to hate on Each other, you guys are just different types of learners. Knowing what type of learner you are is an important life skill, and will allow you to maximize your knowledge. I’m personally a hands on learner, but I shouldn’t frown upon people who suggest reading a book. And vice versa applies.
4
u/PhilosophicalSanders Aug 24 '20
“Applied practice” is the concept of correcting such “failures”. Music, programming, or even videos games can be thought as being applicable to practicing. But the difference between practice and applied practice is doing something with specific goals and/or changes.
With my programming experience, “applied practice” occurs during refactoring and optimizations. At these same times, I’ll sometimes crack open a book or lookup technical documentation.
The fact you have such a binary look on these things is rather disappointing. Please don’t exhaust yourself spreading this bullshit and especially your mindset in a place of learning.
6
u/gemmaem Aug 23 '20
This in an imperfect analogy, but programming has a lot in common with writing. You're having to translate thoughts from one context to another -- from "what I want to happen" into "a set of instructions that the computer will understand in order to make that happen" and maybe also into "a set of instructions that I can understand, or that another human can understand," because it's not enough for the program to do the right thing; it's best if it can do it in an understandable way.
As with writing, there are tropes and conventions that will make your working more understandable to a reader. Also as with writing, it takes more than a couple of months to start comprehending this sort of complicated translation/construction balancing act.
I'd argue that there's even a programmer's form of "writer's block" where you're vaguely aware that you need to find a comprehensible piece of what you're making in order to start putting it together, but you can't seem to get a foothold and start typing.
The problem I’m having is when it comes to breaking down a problem into single step by step problems. Even making a tic tax toe game is a little difficult for me right now.
Yep. It's that blank screen in front of you, right? How do you even start?
"Break it down" is one technique, but it's not the only thing to try. In fact, for me, refining my code often involves breaking a long passage into smaller chunks and functions after the fact. Some things are easier to write in pieces, sure, but there can also be things that are easier to write all at once, and then break down afterwards.
(Why break your code into smaller pieces if it's already working? Two related things: testing, and readability. Small pieces can be tested separately. I've found so many dumb little bugs that way, you have no idea.)
If you can't think how to start, and breaking it down isn't working, try simplifying the task, instead. Don't make a tic-tac-toe game -- make a screen with a single box into which the user can somehow enter an X or an O.
Don't be afraid to write code that you might have to completely re-write. "Kill your darlings" applies to code just as much as writing. Sometimes an entire block of code will be completely deleted by the end, but it was worth writing it, because the process of getting it down was the thing that clarified your thoughts enough to get you to write the rest of the code that did make the cut.
You sound like you're doing fine. A lot of this stuff is "learnable but not teachable," if that makes sense. It's slow wisdom gained over time from practice. Not immediately grasping it doesn't say anything about your eventual potential. Keep at it :)
6
u/twopi Aug 24 '20
The concerns you mention are absolutely normal, and you aren't doing anything wrong. It's very normal for you to be concerned and confused about things at this point.
Tic-tac-toe is NOT an easy project, so don't get on yourself for not being able to do it.
I gave a talk on this very topic a few years ago, and it has become quite popular:
2
u/Adaox Aug 24 '20
Is there a playlist with the rest of your talks?
That was quite informative, and helped calm my nerves about some upcoming tasks in other languages.
5
u/stebrepar Aug 24 '20
There is a Python edition of a book titled "Think Like a Programmer", which is supposed to get at algorithms and other related computer science topics. I think at least once upon a time it was available free as a PDF. Not sure if that's still the case.
8
4
u/Se7enLC Aug 23 '20
It sounds like you're doing pretty well, honestly!
"Breaking the problem down" is a skill that you can develop through practice. It's not really a "programming" skill, per se, but it just happens to be a skill that is crucial to programming.
Instead of thinking about breaking a problem down for a computer to solve, you can also just imagine you're breaking down how a person would solve it... so long as the person you imagine needs really explicit directions.
Like, if you want to sort some things (books, for example) alphabetically, think about what a person would do.
Perhaps a person would start by making a pile of all the As, then all the Bs, etc. That would mean picking up each book, determining the letter it starts with, and then moving it to the pile for that letter. Then they'd have to go through each pile of books, picking up one book and deciding where it goes within that letter.
Or maybe the person would just pick up each book and put it on the shelf where it belongs relative to the other books. You compare the name of the book in your hand to each other book already on the shelf and then insert it at the location where the book to the left is earlier in the alphabet and the book to the right is later in the alphabet.
Different methods of solving problems like that are called "algorithms". As you break down real problems, you may find that instead of going all the way down to each individual operation, you can stop when you get to a problem that is already solved, and then just use a general solution you already know. For example, you don't need to invent your own sorting algorithm each time you need to sort something. You just break down the large problem until one of the pieces is "sort this list", and then you use whatever sorting algorithm you like (be it something you invented or something you learned from an algorithms class).
Same with things like "get input from the user" or "display results to the screen".
4
Aug 24 '20
It sounds like you’re doing great and there’s great advice already in here, I’ll throw in my two cents as a near daily python user for several years -
if you write the same piece of code more than twice, you can/should probably write it into its own function
always be ready to learn from others’ code. I love looking at old PyCon talks and looking through GitHub code in module repos to learn about different styles and methods for optimization and abstraction
You’ll probably find over time that you have similar code patterns you use a lot. It’s likely these patterns correspond to an existing algorithm or design pattern.
Another good method for advancing is looking at something like code wars. It has tons of little challenges you can complete in python and you can view how others solved the problem as well.
1
u/NitroXenonBoy Aug 24 '20
As others have mentioned, it takes years to be able to think like a programmer. It doesn't happen overnight, not in weeks, not in 1-2 months. It takes years to be able to think like one. I started programming 5 years ago, have been programming in various languages. How do you really get a hang / good grasp / think like a programmer? You do projects. Any project. Start with something simple, like make a game of tic-tac-toe. Write a program where you can do some image manipulation. The idea is to take support from online resources when doing practice till the point you are doing some high level project, on your own, and it's possible only because you learnt slowly, and most importantly, understood everything. Always remember,
"it's okay to not know something until later" -winnie the pooh
2
1
1
Aug 24 '20
Even making a tic tax toe game is a little difficult for me right now.
This isn't the easiest program to make. There are a lot of moving gears to get there.
Maybe instead of trying to make a tic tac toe program start with chunking all the different parts of tic tac toe into individual things and solve them separately. I'm going to assume you are making a text-based version of tic tac toe because a graphic version is even less trivial.
Ask a user for their name
Ask a user for which piece they want to be (o or x)
draw a tic tac toe board with enough space to draw o or x inside the whitespace using text
Ask the user to input a move (1a, 1b, 1c etc.)
redraw the grid with that move drawn in place
That's the basics of it. After that, you need to work out how to
store columns and rows (hint, start with lists being rows and then expand to a list that contains each of those lists-as-a-row (lists of lists)
decide how you want to do win conditions start with a simple version of tic tac toe that only does vertical and horizontal lines.
1
u/Cheese-whiz-kalifa Aug 24 '20
Thanks!
1
Aug 25 '20
Yeah, no problems. Tic Tac Toe is one of those things that you think would be easy but it really highlights how much context the human brain can process seamlessly without you realising it.
1
u/perkyterrible__ Aug 27 '20
i relate with you, OP! started learning Python last week through Udacity's free course on Python and i hit a roadblock which are the for and while loops. i allotted two hours per day in learning the concepts and practicing it, but, whenever i try to do their quizzes or try challenges in Code Signal, i can't seem to write a code. i can't seem to find the proper syntax (?) or algorithm to translate the solution i have in mind :( we can do this, OP!!
2
u/Cheese-whiz-kalifa Aug 27 '20
You should really check out python crash course. It’s free online but I liked it so much I bought it anyway
1
u/perkyterrible__ Aug 28 '20
Will def check this out! I'm thinking of trying JetBrains' Python course since they're offering it for 50% off.
1
u/Cheese-whiz-kalifa Aug 28 '20
Download the Udemy app and occasionally check on the price of the automate the boring stuff course. It’s amazing and they give it away free or discounted all the time. Teaches you SO much. I also liked this free course so much I bought the book after doing the free course lol
3
u/tangerinelion (C++ Software Eng.) Aug 24 '20
You've been at it for two months. That's not enough time to learn exactly how Python's syntax works and what it is really doing.
Once you know what things actually do you can reason more about what you can and can't do, and what you'd need to do before you can do what you want to do.
Example: you'd like to relate objects to other objects. This uses a dictionary. What kinds of types can be used as a key? Your type needs to support that set of functionality before you can even use it as a key.
Beyond that, there are concepts that you need to understand. Almost any algorithm you need already exists either conceptually or concretely. For example, if you have a tree structure you should probably parse it recursively. To an engineer, when you hear tree you think recursive functions.
Computer science is literally a 4 year degree. At 2 months you don't even know everything that you don't know, but you know enough to know you don't know enough and you know some of the things you don't know.
2
2
u/TheHostThing Aug 23 '20
I’m pretty new to this too, but I know that 2 months isn’t a lot of time to be learning any new skill. Just keep at it.
2
Aug 24 '20
Dude. 10000 hours before you master it. You have a journey of education ahead of you. Keep asking questions, and practice at it. I caught the bug at age 9 and its been a lifetime of learning ever since.
2
u/WebNChill Aug 24 '20
Funny enough, I posted about binary search the other day. Asking other programmers when they've needed to use algorithms such as this. They told me for interviews, that's it.
2
u/TheSodesa Aug 24 '20
The algorithmic thinking skills (breaking a problem into smaller and smaller steps and solving those individually) required in programming are very similar to the ones needed in writing mathematical proofs. Consider picking up a basic book on discrete math and doing the exercises.
1
u/smokingPimphat Aug 24 '20
You have been learning for 2 months. Give it more time.
If you learned to speak another language with any level of fluency It took way more then 2 months of study to do it.
1
u/wsppan Aug 24 '20
Here is a decent list of 8 Books on Algorithms and Data Structures For All Levels
1
u/CountessO Aug 24 '20
It’s not a day’s job. Coders here better with time and lots of practice. You have to be intentional. There are lot of python videos online. On YouTube. You can try codebasics. He teaches python like he is teaching a 5 year old. Also take some free courses on Udemy and Coursera. Code everyday. Even though it’s for 5 minutes. Don’t be too hard on yourself. Give it time.
1
1
u/Pythag0ras2000 Github username Aug 24 '20
Just to echo what others have said here - practice. Do enough programming, and you'll learn more and more how to think about a problem. However, don't get stuck in "copying down huge chunks of code" territory. It won't help. If you're following tutorials like that, don't. You won't learn anything from that. Instead, pick something you want to code. Doesn't have to be super complex. Before you actually go to your text editor, grab a piece of paper and write down your general idea for how you're going to do it. Not in actual code, just in your words. Get the idea down, and then start coding. My suggestion is fizzbuzz. Start counting in the console, but whenever you hit a multiple of 3, print "fizz." Multiples of 5 are "buzz," and multiples of both are "fizzbuzz." Once you do that, think about how you'd do it with different values, different words, maybe more values and more words. Maybe have the user play against the computer and wait until the user screws up.
Happy coding!
1
u/opoqo Aug 24 '20
You have learned the language, you did not learn programming.
They are different, it is like you have learned English when you were a kid... You can tell stories that you heard and make some changes to make it your own, but you have not learn how to write a essay or a novel.
Stop reading more python books but instead read some basic programming book to learn what it takes to breakdown a problem.
1
u/Deezl-Vegas Aug 24 '20
What I started doing was having PyCon talks kn in the background while I'm working. This helped introduce me to new concepts and ideas as well as get me used to a lot of tech jargon. I found it really valuable.
For tutorials, do the Corey Schafer tutorials on youtube for Flask and Django. Doing both will help you think about different ways to do the same thing and introduce you to web stuff.
1
1
Aug 24 '20
I guess algorithms are only to help you understand how you wanna go about your program... Ao that you can convert it into code... Buts just about your requirement and how do you think it has to work... Which process and which command or method or fucntion you think firts in thats it... If you give an algorithm to two people they write the code in two diff ways foe same algorithm so i feel its anout algorithm... Juat about a little more understansing of your requirement and imagining how it should work thats it
1
u/a8ksh4 Aug 24 '20
Sign up for this course. It's put together by one of the best instructors in the Georgia tech computer science department. It's even a recommended pre-req to their comp sci masters programs.
https://www.edx.org/professional-certificate/introduction-to-python-programming
As others have said, it takes many years to lean to break apart problems into eloquent solutions, so keep after it. Take problems you've solved linearly and rewrite them with functions, and then with classes. Seek out novel solutions as well as resilient solutions.
1
u/Naesme Aug 24 '20
You get in the same cycle I do. Always trying to be a perfectionist and do it right.
Here's what I've started doing recently. I don't care about good design or good practices. I care about making my program work. Version 1 of my project is "Make it do what I want". Version 2 is "Clean up bugs and errors." Version 3 is "Refactor using good design". As you go, you'll eventually combine those steps so Version 1 is all of those things.
As far as breaking it down, just talk through how it works.
Tic tac toe for example. How exactly does it work?
Step 1: Draw game board Step 2: Decide who goes first Step 3: Player 1 places a symbol in an open spot on the board 3a: If Player 1 has 3 symbols in a row, they win. Step 4: Player 2 places a symbol in an open spot on the board. 4a: If Player 2 has 3 symbols in a row, they win Step 5: If all spaces are full, it's a draw. Otherwise, repeat steps 3-5 Step 6: Declare the winner
Then you ask yourself questions about how you'd get the computer to do it.
How does the board get displayed to the player, and how do I keep track of the spaces so they can be referenced and checked?
If there's a computer, how does it pick a spot?
How do I repeat steps without rewriting all of the code?
And the list goes on.
At first, you're going to have to look things up and try things until something works. Over time, you'll eventually grow.
Stop doing the same problems over again. You'll just memorize answers and that doesn't help you understand it.
1
u/bobbyrickets Aug 24 '20
Cooking is very algorithmic. If you can understand how cooking works you've got a fundamental understanding of the algorithmic relationships between certain recipes and ingredients and the ways they can be combined.
You need to keep learning and keeping an open mind. It's a process dude.
1
u/Sanguineyote Aug 24 '20
The best tutorial is practice! Im also new to python but I find creating programs that I need / find interesting is the best practice! For example just now I finished some final touches on a automatic bot I've created for a game. Before deciding to this I had no idea what to do, just an idea, and some basic python knowledge. I just googled and googled till I had all the information I needed to build the bot, building it piece by piece, testing it after every new line of code.
Just practice by creating stuff you need/ are interested in.
1
u/deadant88 Aug 24 '20
I've been going for about 2 months now. I hated learning python when I first had a go, I got a Udemy course and a book and almost died of boredom and frustration. Knowing different data types was fine but it sure wasn't motivating.
This time around I came to learning with a clear project in mind, I haven't looked back. I just started going, worked out the first bit of functionality I needed (webscraping) and began there, then worked out the next bit which would be good, storing data, so learned some PostgreSQL and SQLite, now I'm working on the next part, a way for people to access the data (Django).
If I had to name the mindset of programming so far: it is a process of constant iteration, problem solving, asking good questions, reading and patiently working through frustration.
1
Aug 24 '20
You might not know the core language too much and what is at your disposition. You break down a program into little problems that you solve using the tools and features of the language. If you're not familiar with those tools, then you'll be lost.
By example: for a blackjack game you make the card an object, with different attributes, value, number, suit, etc. Then you construct a deck by using list comprehension, then you shuffle the deck by applying shuffle to the list, then you make the hand either another container or perhaps an object, then you make each round a function, etc etc. You need to be familiar with a lot of these tools and features of the language otherwise you'll be making things harder for yourself.
Also, at the beginning we all just want to start coding right away, but it is very important to write down the logic of your program and break down each problem first, so that you can use the language features to help you solve all those small problems.
1
u/OrionBlastar Aug 24 '20
It takes years to think like a programmer. I learned BASIC on a Commodore 64 when I was 12. I didn't think like a programmer until I was 16.
1
u/Sotovision Aug 24 '20
Short answer : type and test. Type a little line of code that you may think that is going to help in building a whole program. Then test it. If it run like you were expecting to run, GREAT!. If it's not, then re type the code. That way, you will be force to think step by step for every line of code. Also,TL:DR your whole comment xD
1
u/jandrew2000 Aug 24 '20
I’ve found programming to be like any other skill I’ve learned. If you are passionate about it you will always push yourself forward into new territory and therefore always feel like you don’t know what you are doing. That is totally normal.
Another thing that is totally normal is hitting frustrating plateaus where you don’t see any improvement. This is when books come in handy. I’ve found that picking up a book when I hit a plateau opens up new ideas and, rather than having to use canned text book use cases, I have my own examples I can go back to and improve using those new techniques.
As others have said, give yourself time, work on problems that are fun and useful for you. Write things you can be proud of and excited to share. Revisit your old code frequently and search for ways to improve it. By doing these things you will start to see how much better you actually are (because every line of code you write will feel ugly to you a few months after you write it).
1
u/amrock__ Aug 24 '20
Do something fun and something you really want to do even if yoj don't know ypu can learn concepts
1
u/MEGACODZILLA Aug 24 '20
You don't have imposter syndrome, you have a case of being a beginner. Chill out, cut your self some slack and keep on it.
More than anything I have ever attempted in life, programming truly is a marathon, not a sprint. There is a lot to learn and that only comes with time and effort.
1
u/09TYNINE Aug 24 '20
The thing I say to every new programmer is have a goal in mind and when you learn a new function or concept think how can this help me achieve my goal (And just for reference when learning a new language the first thing I make is a number guessing game on it's pretty basic) tic take toe can be somewhat harder as it requires actual intelligence in the air what I found to be a good challenge after that was rock paper scissors (which I'd recommend with pygame) as a good chalangeing next project
1
u/Coniglio_Bianco Aug 24 '20
I've been programming for 2 decades. I think you're not in a bad place for how far along you are. Don't sweat the small stuff, just keep building and studying.
The more you do it the better you'll get, and the easier it will get. Just don't forget to read up on algorithms/design patterns along the way. The more you build stuff the more that stuff will make sense to you and how different algorithms/design patterns will apply to what you're building.
Hang in there :)
1
u/that_outdoor_chick Aug 24 '20
Just practice, practice and practice, unless you have a very math based education (not talking high school, more in terms of university math, where you have to solve problems and write proofs), it won't happen overnight. As with everything, there's no talent and 'some people were born thinking this way', only hard work and that won't happen in couple of weeks.
1
Aug 24 '20
Man only practice can help. I also get stuck on this step. Just more practice and all will OK...
1
u/casino_alcohol Aug 24 '20
I have been doing python on and off for years. I just use it for personal use and I am learning django slowly at the moment.
i also have no idea how to make a tic-tac-toe game.
Work on stuff that you understand. I have done projects with aws api's the reddit api's.
I have done some web scraping and stuff.
My point is that if you can't figure out a game then take a break from working on a game, especially if you do not want to make games.
1
1
1
u/retrogambit Aug 24 '20 edited Aug 24 '20
That's the problem with the beginner tutorials and the bootcamps etc in my opinion. They give the impression that anybody in the world can code if they just study for a few months. It's a ridiculous notion. You can learn the syntax in a few months but that's a tiny part of learning to program. What helped me was finding a project I was really interested in. Then I learnt the libraries I needed to make it work. Rinse and repeat and throw in some quality books on the topics you want to get in depth with and after a while you start to realise that you don't have to search the internet to find out how to solve a problem because you already know how, through experience. I might add that when you start to get moderately proficient and thinking about gaining employment, look for jobs that you are interested in and learn the libraries they need. Then make a few projects incorporating those libraries to showcase the skills you have.
1
u/tumblatum Aug 24 '20
Exactly in the same boat. My plan is once I know syntax of Python, try to solve as much as possible, coding exercises. You know there are books full of exercises, you take one of them and start solving problems in it. Like in math, back at school. And I guess you will notice patters there. There just can't be endless number of unique problems. Some patters will evolve over time and you will know the type of the problem and an approach to solve it. It probably will take some time, however, one day you can say you have the skill.
1
u/Spread_Public Aug 24 '20
Like others said, just practice. The more you code and get your mind info the routine of things, the more you reflect it over time.
As far as impostor syndrome, everyone gets it. I've been programming for 23 years and still feel this.
1
u/wobblycloud Aug 24 '20
If you're unable to break down a problem into step by step, try to brute force and then optimize.
1
Aug 23 '20
Programming Pearls by Jon Bentley
Examples are in C, but if you want to learn how to bend your mind to think more algorithmically, then read it.
You should at least have a passing understanding of C syntax anyway, because even if you're 100% a Python coder, you will be exposed to C++, C#, and Java from time to time and knowing C syntax is necessary.
0
u/developernexus Aug 24 '20
Whenever you get the chance, I would recommend that you try out installing a Linux OS (dual-boot, virtual machine, etc.). As an operating system, you get much closer to the programming in Linux. The very act of troubleshooting, maintaining, and optimizing my installs of Linux has done wonders for helping me think more "programmatically". You, also, get introduced to a massive array of programming languages, and a community that is - - generally speaking - - wonderful.
"thinking" like a programmer is probably a bit misleading anyhow. There is no one "right" way to think when you're programming. Logic is helpful, but creativity - - the ability to approach an issue from "outside the box" - - is incredibly valuable.
My best advise is... Find an issue that you can solve by writing a simple program. Maybe you want to create a simple SFTP program, or something to help you backup your files. The goal is to be interested in what you want to create, and then simply dig into the project. Do your best, but don't expect perfection. There's plenty of time to iterate upon your initial project after it's completed.
-3
u/OnlySeesLastSentence Aug 24 '20
To me, an algorithm is a fancy word for "loop". People might disagree, but I don't think, for example, a formula would be a loop. That is, there's no algorithm for doing a Pythagorean theorem question. You just solve it.
But there is an algorithm for reading a book:
While pages exist:
...while lines exist:
.........while words exist on line:
.................read words
.........go-to next line, start on first word in line
...change page
0
Aug 23 '20
[deleted]
2
u/Cheese-whiz-kalifa Aug 23 '20
Yeah for sure man. I’d love some ideas. I was thinking about starting small and just building a simple text based adventure game but I’d love to hear any ideas for projects you have. And thank you for the site recommendations. I just started practicing on Edabit two days ago so I was hoping that will sort of help me to active yet passively learn and get better if that makes sense
3
u/thunderwat Aug 24 '20
I do not know why i wrote this i was interested to write it i think and sorry for my bad english
I'm in a similar position, i started about 3 months ago around 290 hours now, and feel the same way is that I can't think like a programmer, and was jumping from tutorials to tutorials, which after the video i forget nearly everything. i wanted to make small GUI projects so i made about three.
The GUI part, was easy and what I think it was is the back-end where the think like programming thing happend for me, I learned about lists but nearly never used them so i decided to use it for the GUI that i wanted to do (password generator) and that was maybe? the first time i ever used list's or thought about it, actually I so a solution where they used the list in a code which made it less lines of code, that's where I so how useful lists were. The second time i so usefulness was in a programming problem which made it soo much easier. this made me never to forget about them.
also, I use Edabit sometimes when I don't really have anything specific to do. In my opinion it was and is still useful for me as i learned some things that I can use it like solving a problem then seeing how others did it improved my code. There are many things that I forgot about when i saw tutorials then in Edabit it made it stuck in my head the things that come up now is sum() and min(). that i found useful maybe there are many things but I can't remember them right now.
TLDR: I think you just have to keep practicing
1
Aug 24 '20
I've been toying with learning python for about 6 months I've put maybe 3 hours of learning into it. In the past 2 weeks or so I've been given a task at work that will happen in October. I don't want any part of this manually so python will do it.
Past 2 weeks has been "targeted" learning, i have put 6 hours in and I'm almost done.
I feel people who take on something new thinks they need to know everything to do it, in reality you just need to know enough to do what you want to do.
First for me is an RPA Then a ticket submission system
1
u/inkman Aug 24 '20
Make it even simpler, you'll be surprised what you learn from making the most mundane things, a stopwatch for example.
0
Aug 24 '20
[deleted]
1
u/Cheese-whiz-kalifa Aug 25 '20
Yeah I kind of don’t want to fall into that trap of course collecting or tutorial purgatory. I’ve been on Edabit lately and have joined code wars and did like fifty problems today. My goal is to keep doing that and progressing to harder and harder problems.
I have a goal of at least an hour practice a day but I’ve decided for the time being I may just be in that practice practice practice stage and it’ll just naturally click for me one day as long as I keep stepping out of my comfort zone to further my understanding. And continue to focus on one book at a time or something
2
u/wildpantz Aug 24 '20 edited Aug 24 '20
Two months isn't enough to develop a sense you're talking about, but you'll get there with practice and it will get better and better.
Think of it like this, there's so many ways to do stuff, sometimes not as efficient but you're practicing so you don't care.
For tic tac toe, there are nine fields. You COULD make 9 variables and program logic between them, which would probably be a bit tiring, but definitely doable.
You could use 3 lists, each list representing a row or a column. You could even make one list containing 3 lists which would be a bit tidier but more confusing to use in a long run perhaps.
You could use a dictionary with 3 keys, each key containing a list. :)
Then you need to think of logic to enter something in the field, sort of like text prompt asking which row/column (which is sort of easier and less tiring to do if you just create graphic interface, but it doesn't matter) and you can make a loop so it plays like a game until a certain condition, in this case a win, has been met.
As for recognizing wins, if I'm not mistaken that will just be a medium sized bunch of if/elif statements checking if all entered symbols are the same, do all possible combos as there aren't many (8 I think, 3 vertical, 3 horizontal and 2 diagonal).
You could try develop some primitive AI to play against too. For example when I wanted to make games in java years ago I followed this guide where you were kicking a ball as a demonstration of physics, so I made sort of a tennis court and made player 2 follow
verticalhorizontal coordinates of the ball all the time and if the ball was below certain height, the AI would jump to kick the ball away. It was so funny and obviously not as good as usual games you see, but it was a good practice if nothing else.Basically, try to think of a way to develop a system with data type you know how to use. As you practice more, you will learn to use different variables, modules etc and you will learn how to solve problems better. Try to do stuff on your own if you feel you can do it, it has helped me more than any guide. Cheers :)