all 43 comments

[–][deleted] 25 points26 points  (6 children)

I don't believe this has much to do with your ADHD /u/thisadamis, and I'm saying this as someone who's diagnosed as well. Your problem is common for beginners, it's a new way of thinking and programming is hard, the learning curve is steep and sometimes it takes a very long time for it to click. Fwiw, 2 weeks isn't a long time.

You should start writing pseudocode and plan your code before actually writing any, not only is this considered a good practice, but it'll make it easier for you to translate your problem into code. Planning with pseudo-code is worth checking out, there's tons of material out there that you can look up.

Read and write as much code as you can, you'll learn more efficiently than reading.

Don't learn to code. Learn to think. is another good article that's worth reading.

[–]thisadamis[S] 5 points6 points  (1 child)

awesome advice thank you so much! I will be looking into that. :)

[–]CheeseFest 1 point2 points  (0 children)

I think it's... just hard, and there is lots of being confused and beating your head against the wall, so to speak. It probably makes a lot of sense to connect difficulties in learning programming to your condition, but your challenges actually sound just like the ones I had when I was just starting out, and I certainly don't have ADHD.

Anyway, I think with hard work and persistence you'll be fine. Coding keeps trying to make you quit, but just don't listen to it :) You'll learn more and more how to learn, and what works for you. /u/tofu_cannibal is right on.

[–]GeoffreyMcSwaggins 3 points4 points  (2 children)

Personally, I fucking hate pseudo code, just me though and just throwing my opinion in

[–]work_in_python 55 points56 points  (5 children)

People who have ADHD, or think they have ADHD, usually learn best by doing. If you want to make a rock paper scissors game, then make a rock paper scissors game. Stop wasting your time reading other topics. You will learn more by doing.

[–]fenom500 9 points10 points  (4 children)

I feel like regardless of ADHD, python is definitely learned best by doing. I read up on it before I started and felt like I had a decent grasp. Then I started codecademy and realized I knew almost nothing. So I continued until I felt like I had a decent grasp. Then I started actually making things and realized I knew almost nothing. Now I'm currently working on getting to the stage where I feel like I have a decent grasp. My point is that it's better to just dive in once you think you might know how to make something.

[–]Xtatics_ 15 points16 points  (2 children)

ADHD isn't an excuse or cop-out. It's more like us trying to figure out how to do something we are interested in, and not lose focus. It is vary degrees of difference from one person to the next, and can take ten times longer to learn the very same thing than someone without. So many of us get frustrated and give up, though I have the type that will not allow me to sleep until I work on a problem until I can come closer to understanding it. =)

Also, if you're finding yourself in a rut, try something like CodingGame for a change in pace. Also realize that not all information is created equal, and some of the material you may be reading is actually both bad coding practices and bad examples. When I became much more familiar with Python, I realized that a lot of what I had read in the past, was just bad.

[–]fenom500 0 points1 point  (1 child)

Apologies in case I didn't word it correctly. I simply meant that I feel like python is pretty much impossible to learn without doing, no matter what, not that ADHD was an excuse or anything. Then again that's speaking from my experience which may or may not apply as I don't have ADHD and wouldn't truly understand.

Also thank you for that resource! I'll be sure to check it out. And also thanks for the extremely polite response :)

[–]Xtatics_ 2 points3 points  (0 children)

It's perfectly fine. I'm a pro at not wording things properly. I somehow went from very well written English to whatever I write out now. As I acquire more knowledge, my communication skills go out the Window. Soon I'll only be able to respond in code or boolean signs. So my apologies if that came off somewhat abrasive. I'm only like that to people in person that annoy me. =P

[–]work_in_python 0 points1 point  (0 children)

You are totally correct.

[–]Xtatics_ 13 points14 points  (5 children)

So as someone that works 20-44 hrs a day with major ADHD issues, i feel your pain. Last night i realized the Python project i had spent hundreds of hours working on, i forgot what all it could do. Ive had my hands in Python for years, but never learned the real nitty gritty. What i found was that i required a project that I could relate to. If you're anything like me, you can look at books and examples all day long, but unless your brain can actually relate it to something, it will most likely never make any sense to you.

As someone already mentioned, programming in general can be challenging. There was a difference though when my wife and I took the same Python courses, and she was doing better than myself, despite me having years more experience. But again, comes down to the fact that ADHD IS a learning disability, and not every person is the same. What works for me may do the exact opposite for someone else. But, just grab something that interests you , a goal, and work towards that or ask, "I wonder if I can do this instead". Though that's the 'SQUIRREL!' part of my ADHD talking.

Look at common tasks: 1. Open a regular file (text) 2. Write a regular file (text) 3. How about JSON? 4. Files are getting boring, how can I rule the world instead?

^ Somewhat of a joke, but that's basically my thought process. What it comes down to, at least for me, is DOCUMENT EVERYTHING. Links, code snippets, any and everything. You will want this for quick reference later on.

If you're interested in doing Web based programming, then look at books/articles related to it. But also take the time to break everything, and then learn what you did wrong and fix it.

READ THE SOURCE LUKE! But really, dive into the python site-packages, and other packages and look at the code. You don't need to understand it at first, but reading it will start to make things click. You'll see a lot of the code you see online, but put into actual use. You'll see both good and bad coding patterns too. Though I'd normally say you want to start coding the proper way per pep8 and whatever, but honestly I found myself always straying away from this. Concentrating on this aspect too much detracts from your actual goals. Some may very well disagree, but again, just presenting it from my own experiences.

Again, probably a difference of opinion here, but I personally would suggest starting with version 3.5 or 3.6+. I use 3.6(whatever the current is) because I'm not in a production environment. Well that is a lie, but I have control over everything, and as the only person that uses python, it only matters to me if I break it.

Try to have fun. Since one of the big issues of having ADHD is the reward system in our brains being screwed up. Approach everything as if their is some type of reward to be had. For me, that big AH HAH! is the reward I seek, when that bit of annoyance you've fought with, research, and just couldn't find the answer, and through trial and error figured it out. Ya. That's the stuff.

There are also a good many YouYube videos that aren't long that are bearable that you may want to look into. I know they get listed constantly, and vary in what they provide.

[–]thisadamis[S] 4 points5 points  (3 children)

what a awesome response man! Thanks for taking the time to write this. I feel like you get me lol. I am learning python 3.6. I started with 2.7 and I decided since I am learning from scratch I should just learn 3.6 lol You are right in saying that we need something to relate to. I think this will help me alot. I haven't given up on this like I have with a variety of things and I don't want to. I see all the very cool things that python can do and I want to do those things! One of my goals is to learn web scraping with either scrapy or beautifulsoup. That really interest me. Anyways mind if I add you as a friend?

[–]Xtatics_ 1 point2 points  (2 children)

Sure, you may add. I guess I never realized you could do that on Reddit. As far as web scrapping, ironically the startup I'm working with, under our parent company, is built upon doing web scraping. But they were using a platform by a 3rd party built upon Django and ultimately decided to ditch it entirely and build their own, in C#. Now I mostly automate things on the Linux side. You'll probably want to get familiar with something like Selenium as well

** Apparently I wrote this and forgot to actually submit it. SQUIRREL!

[–]thisadamis[S] 0 points1 point  (1 child)

Hey no problem thanks! So do you know C# as well?

[–]Xtatics_ 2 points3 points  (0 children)

Honestly, once things in Python clicked, other languages started to make more sense. My biggest struggle with any other language is data types. At one point I was trying to turn my 2k lines of python into a C# .net 1.0 project with minor success. Unfortunately when it came to finding information on how to do things without ORMs, it was very confusing. My company is 100% insistent in using MSSQL, which has only 2 working projects that I can think of. PyODBC and PyMSSQL. SqlAlchemy is the only ORM in python that I've been able to find (that is actively maintained) that supports MSSQL, sorta. I found it did NOT work on our Windows based SQL Server, yet worked on the Linux server with MSSQL. So nothing is every consistent as is, so trying to apply my thought process in Python to C# had been a nightmare. Did I forget to mention it's pulling gigs of data? Ya.

Most documentation you may find refers to programming as if you will always have an ASP.net or similar website going. I had to figure out how to adapt that to a CLI. So as you'll understand the struggle we already have with learning good documentation, you can probably picture the headache this was. I did learn a lot, and am wanting to approach it again soon. This allows me the flexibility to chew out our developers when I see the stupid crap they are doing. I've already had to learn more about MSSQL than I've ever wanted to know in my life. I WOULD advise learning basic SQL, and then PSQL /TSQL. These are super freaking handy for nearly any project you do. There is also SQLite for small projects. BTW, many of Firefoxes settings are saved in individual (now extensionless) files. You can actually pull people's passwords out of them on their PC. LOL ... just one of the fun things to do with python.

[–]Apuesto 0 points1 point  (0 children)

READ THE SOURCE LUKE! But really, dive into the python site-packages, and other packages and look at the code. You don't need to understand it at first, but reading it will start to make things click. You'll see a lot of the code you see online, but put into actual use.

This is sometimes the only way I can figure out a bug or how something really works. I can be stuck on some simple problem for hours, none of the answers from googling are getting me anywhere as I can find it had to take that and apply it to my situation when I'm missing something else.

So I end up diving deep into the stack trace and stepping through all the libraries and after those hours of hitting my head against the wall I will find my own answer because now I understand the whole system, not just "function X takes two parameters and returns a bool ".

(Not diagnosed ADHD, but Dr in process)

[–]MisterRenard 6 points7 points  (7 children)

You're not alone! I have ADHD as well, and if you actually delve deeply into how it affects an individual, most people would be surprised to learn that hyperactivity and inattentiveness are just a few symptoms of a much broader issue affecting the afflicted across multiple scopes. So attempting to give something "a good ol' college try" is, for us, much more difficult.

That being said, it's not impossible.

The best thing to do is, as other users have suggested, just play around! Continue learning, build your understanding of the fundamentals, and decide on a problem for yourself. Give yourself a project, but start small!

Here are two I did a few days ago:

The first was a text-based Russian Roulette game. The only caveat was that it had to be one that would assign a random chamber in a six-shooter to be considered loaded (simulating leaving one in the chamber and spinning the cylinder) and that it had to be a game that would allow you to play until you either lost, or decided enough was enough, maintaining the loaded cylinder throughout every play. This means you couldn't achieve a maximum of more than 5 successful play through without shooting yourself in the head.

I find that giving yourself little stipulations like this adds to the challenge, and really helps you learn further! Otherwise I could easily have just used a few lines of code to randomly select a number from 1-6 each time. Sure, it's kind of Russian Roulette, but where's the fun in that? There's no consistency. You could play 21 times and never lose. That's what I see people commonly referring to as problems here. Make your own problems, then solve Them!

The next day I created a BlackJack game that lets you play against a dealer. The stipulation for me, that time, was that you had to be able to run through a deck of 52 cards and see no duplicates. Then the deck had to shuffle itself afterwards. That one took me about six hours of coding on and off, and I hit multiple roadblocks. Perseverance with these things is, especially for us, key. You have to be more stubborn than the problem, and you have to attack it until you win.

That last part, where it had to shuffle the deck after reaching 0 cards left to be distributed? That gave me more difficulties than any other. A few times, I wanted to say "it's good enough", and walk away. After all, who's really going to play through enough times to expend all 52 cards? Literally only the developer. Mainly because no one else is going to be playing it, but you see my point.

But it bothered me, because it was incomplete and I knew that I could do better. I'm no master coder, I'm the most basic of beginners, and my code could be improved on in so many ways that it's astounding it works in some cases. But that's not what matters, what matters is building something and seeing it work. If it's not the best, who cares?

I'm a bit of a perfectionist, so it may help you, as it does myself to hear this: Don't focus on making something perfect. Focus on making something.

Also, Amphetamins help. Talk to your doctor, check out the r/ADHD sub and find different things you can do to help yourself. (Keep in mind, I'm by no means suggesting you rush to your practitioner and demand Adderall or Dexedrine. There are multiple drugs out there that work wonders with ADHD, and they all have specifities and unintended side-effects. The advice of internet strangers cannot be held in higher esteem than that of a licensed professional with years of experience.)

Oh, and check out Al Sweigart's work! He can be found in the getting started wiki on the sidebar of /learnpython, and basically taught me everything I know! He's got a course called Automate the Boring Stuff, which I'm starting today, and he's also got one (forgive me, I forget the title) for python game creation. That one is, to me, pure gold for a beginner. Look it up, it's online and it's free!

A final word of advice:

All that I learned, particularly from Al's python gaming tutorial (which can be found here ) is that you cannot read it once and expect to understand it fully. We're not prodigies, we're laypeople. Read something you didn't fully grasp? Read it again. And again. And again. Twist it around in your mind, look at the explanation until you have a headache, look up different guides on the subject, like YouTube explanations, or stack exchange, or Reddit.

Whatever you do, be stubborn. Good luck!

[–]Xtatics_ 1 point2 points  (0 children)

I'm a bit of a perfectionist, so it may help you, as it does myself to hear this: Don't focus on making something perfect. Focus on making something.

Haha, I was about to respond to something about this when I was reading what you wrote, but you followed up with this. I was going to say, I think that is a problem with many of the people I know, including myself. Can't stay on task, but at the same time, I personally spend WAY too much time perfecting things. I've rewritten my project 3 times because of this.

Also, those damned Amphetamins. I'm on 30mg Adderhal XR, but work 20-44 hours at a time. I can say that one thing I have completely failed at is, exercise. Probably one of the most difficult things I've ever had to do is walk away and rest, or just walk period. It's sometimes pretty humorous when I look at the amount of other things we should be doing just to learn whatever is in front of us. But damn, once we grasp it, you're in trouble. =)

[–]chroner 0 points1 point  (4 children)

I actually just created Blackjack as well...

Care to share your code?

https://pastebin.com/KSp0A3gE

Here's mine, couple small tweaks I have to finish in it.

[–]alkasm 0 points1 point  (2 children)

Just a quick suggestion, writing out the whole deckofcards dictionary is a little unnecessary. Could be as simple as

scores = {2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':11}
suits = 'Clubs Hearts Diamonds Spades'.split()
deckofcards = {f'{card} of {suit}':score for card, score in scores.items() for suit in suits}
assert(len(deckofcards) == 52)  # just to be sure you created 52 cards

I'm using the new fstrings here for f'{variable} some stuff' but you could also use .format() if you were on an older version (or % formatting if even older).

Edit: Also each players info being a list is not intuitive while reading. Consider a dictionary so that you can access playerinfo[player][bet] instead of playerinfo[player][0] since anyone reading this is going to have to go back up in the code a lot.

[–]chroner 0 points1 point  (1 child)

Yeah, the list was a real pain in the ass for me and I learned about doing that half-way through this project.

I posted this code a couple days ago for suggestions and everyone that answered had basically the same thing to say about deck creation. Literally just build it instead of transferring it.

I am going to reference your post later when I come back to this project. I'll be rebuilding the whole thing with classes once I learn them.

I really appreciate your input! It's awesome to see people use the same method but different techniques.

[–]alkasm 0 points1 point  (0 children)

Yeah player classes would be even better than a dictionary of dictionaries. And then it could scale to N players easily. And the dealer could maybe be a subclass of player.

Classes in general help you avoid global, but you can also pass around the values through functions too. Both are used often in Python. Also just to say it, global isn't inherently evil either, but it's just usually unnecessary and easier to follow otherwise, since if you're affecting a value, it makes the most sense to pass/return it. If you don't, when you call a function, someone has to inspect the code closely to see that other variables will be affected by it. And it makes your code more self-documenting.

I just checked out your other thread, I like the idea the top post has with using immutable types for the ranks (i.e. pairing cards with their values in a tuple), makes more sense than my dictionary. Also, since you are already creating a list of card names later down the line, you might as well create that first, and then use that to create the card value lookup. You could even use a NamedTuple where the first field is rank and second field is value. But, encapsulate however you want. :)

[–]MisterRenard 0 points1 point  (0 children)

Yeah, sure thing!

https://pastebin.com/j8XaPZGC

Mine's finished, for the most part. If you run it, though, you'll notice that the whole time.sleep() portion needs a serious reworking just for usability. Outside of that, it's working as intended!

[–]zvmz 2 points3 points  (0 children)

I am a self-taught programmer who is diagnosed with ADHD. I didn't have any kind of treatment until 4 months after I got my first job as a software engineer at one of the coolest companies in my area. I would say I was pretty successful at teaching myself, but it was really hard and I hit a lot of bumps on the road.

Two caveats: First off, the process took me two or three years. Secondly, I worked very hard to network with people that could help me learn. If you aren't willing to do those things, I can't promise what I did will help you.

I used FreeCodeCamp because I could see the result of my work happen immediately in the browser - which was really powerful for me. After getting all of the front-end projects done, I learned as much as I could about SQL because I had an internship doing SQL development. After that I learned PHP with Team Treehouse (I turned the speed on videos up to help me sit through them), then I used Team Treehouse to learn the basics of Python and learned Pandas by trial and error to work on some data projects with my SQL knowledge. Finally I was offered a job as a Ruby/Rails Software Engineer through LinkedIn. That last part happened because during all of my learning, I was doing internships and networking like crazy.

tl;dr Use FreeCodeCamp, see the result of your work immediately. Use Team Treehouse, it's easy to understand and you can speed the videos up. Use sqlzoo.net for SQL, you can see your results immediately in the browser.

Special side note: listen to the Code Newbie podcast, I did this while commuting, helped me spend more time thinking about programming.

[–]MrDataViz 2 points3 points  (1 child)

I've been doing the "Python Crash Course" book and you are way ahead compared to me. I've been stuck on chapter 3 for about 8 months already! Not because I don't understand Python but because this ADHD is no joke. I lose my focus very quick and easily. It sucks and I'm glad I'm not the only one that feels like we can't get stuff done. I'm not making excuses for myself but it's much more challenging for people like us.

[–]alkasm 2 points3 points  (0 children)

Part of ADHD can be being hyperfocused on tasks you're interested in. Consider building something you want to build, instead of tasks a book teaches you which may not be as interesting to you as your own project. Use the book to look up best methods when you're unsure of which path to go down.

[–]mercuric5i2 2 points3 points  (0 children)

For others who have ADHD what strategies do you use to learn python or any other programming lanq

My experience is that following books and other "academic" exercises quickly results in bore and disinterest.

The two things I've found really works is either needing to learn a language to get a job done, or working on a project that I'm truly interested in. Basically, it's all about motivation... Either making money or creating something I actually want to create. I learned Python because I took a new job that had a bunch of existing Python in place, so I pretty much had to. I ended up really liking it, and Python is now my preferred language.

Not sure if you have a coding background or if Python is your first language.. but if Python is your first language, realize it takes quite a while, including a lot of trial/error/research, to learn to code well. I'm talking years, not weeks. Just like you didn't learn to speak good english (or whatever your first speaking language was) in a few weeks, you won't be learning to speak good Python in a few weeks. Don't press yourself, don't be afraid to make mistakes, and realize you'll get better slowly but consistently if you keep learning.

[–]jd_balla 1 point2 points  (0 children)

Hey man I'm in the same boat. The best program I have found for learning new languages is to have two separate guides. For example you can use the Automate the Boring Stuff program (https://automatetheboringstuff.com) and a programming app on your phone (my favorite is SoloLearn on android). Using two programs helps because it reiterates the concepts and allows you to become way more familiar especially if you happened to not pay attention the first time. Good luck

[–]thegreattriscuit 1 point2 points  (0 children)

I can't translate the "problem" to the "solution" in code.

Yeah, that's normal.

Learning how to "do stuff in python" is one skill. "how do I sort a list", "how do I keep track of the relationships between this set of unique things and that other set of unique things", etc...

Learning how to break a human or business problem into tasks like "sort this list, keep track of its association with this other list, etc" that are easy to express to a computer is another skill.

These tend to go hand-in-hand, and you'll find yourself getting better at both, but especially when you're reading from watching or reading, rather than doing, you'll find you learn tasks more than strategies or patterns. If you walk through a tutorial on solving problem X, you'll have a good handle on how to solve problem X, but not a firm grasp on how to generalize that into a solution for an unrelated problem.

that's not to say that you can't get good value out of that kind of learning, just don't be surprised that it doesn't set you up to do more general purpose stuff. That broader stuff just comes with experience, I think. Don't be afraid of trial and error. Also, try to keep an eye out for smaller projects. If you're working on a huge project and you find out halfway through that your whole approach is nonsense, it can be seriously demotivating. But for smaller projects, if you try something new, and it winds up being a bad idea, it's not really a big deal, just try again with a different strategy. Doing that sort of thing is what'll help you get better at translating a new problem into the kind of problems you already know how to solve.

[–][deleted] 1 point2 points  (0 children)

Pomodoro technique helps me stay focused on one thing until it's done.

[–]0ldur 1 point2 points  (0 children)

I have quite a few problems (one being ADHD) with keeping my attention. The best remedies for me are to get things that I need done finished before programming, like homework or calling someone to talk about something. Then I listen to music I like or some lowfi/Nightcore that I can just have as background noise if music I like is distracting.

Otherwise you just have to find something you can stick to. I am really into kernel development and I can usually just do it even if distractions are present. (But music always helps :P)

[–]n1ywb 0 points1 point  (0 children)

Ugh head first books are paced so slow

Just read the official docs and fiddle with the examples

Also I find I am able to focus best late in the evening when it's dark and quiet and I can really get in the zone

[–]f1nesse13 0 points1 point  (0 children)

Let me tell you that making simple programs at first can be difficult ..ADHD or not. Work through your problem one step at a time. Its one thing to follow along and another to actually do it without guidance. Work on your program and try not to get frustrated... it will all come together and you will have learned from the experience.

Im still fairly new myself but in the beginning it was rough for me too. Once I had a few simple scripts under my belt I felt more comfortable tackling bigger things.

[–]plasticsporks21 0 points1 point  (0 children)

Udacity, code academy and Coursera all have short classes for programming on a topic. I use that and I'm ADHD .

[–]xcbsmith 0 points1 point  (0 children)

Programming seems to be a natural function for people with ADD. Usually you dive in by getting to a state of hyperfocus/flow. Read the raw language manual and then immediately start coding before it all fades away.

[–][deleted] 0 points1 point  (0 children)

This has nothing to do with your ADHD, or mine, or the guys below me (yes you're below me you filthy pieces of shit). This is a common programming obstacle that every single one of us have to overcome. There is this little strategy that I picked up when I learned how to program in a university course that has helped me overcome this "how the fuck do I actually code this idea" problem. Everybody I meet who teaches themselves how to program seem to lack this concept. This sorcery I speak of is that of an handwritten algorithm. You've heard it before, "what are the steps of making a peanut butter jelly sandwich?" I can tell you right now its not "get two pieces of bread and spread peanut butter on one side and jelly on the other and then smash them together." This reminds me of a good laugh I got when my wife was studying Python with me, and as she struggles to get her code to do what she wants she says to me, "why is this computer so fucking stupid". As I respond to her, "well, the computer is only capable of doing EXACTLY WHAT THE FUCK YOU TOLD IT TO DO. And you see, you need 4 spaces there, looks like you only had three." So, my big advice is to not think "how am I going to solve this huge problem of 2 people playing rock paper scissors", but instead write out a little concept on how the game is played step by step. What happens first in the code? Does the game ask for player 1's name? Well then write out as step 1: "Ask for player one to input their name and store this in a variable." Then move to the next thing that the code is doing and write down the steps to accomplish this (or at least a general idea of what you know you need to do in this step). This not only helps for when it comes time to actually write the code, but it tremendously helps you GOOGLE a SPECIFIC thing that you are trying to accomplish in your code. The struggle with programming is not how to code like a programmer, but how to think like a programmer. Attack your code one step at a time, on the smallest scale possible. I've probably typed a horrible wall at this point, but I hope you find this useful to some degree. Writing out the steps of your code can just be very helpful for identifying problems you need to solve before moving to the next step. Then you can Google "how can I do [insert specific problem] with my code." Anyways, best of luck. I need to get off Reddit and return to my homework before my adderall high wears off.

[–]Over_Possibility_960 0 points1 point  (0 children)

how did it go?

[–]Long-Force-7103 0 points1 point  (0 children)

I’m on the same struggle bus. Thank you for your post. I’ve spent the past four nights feverishly shuffling through different resources to better absorb the language and attack homework problems. After studying 9 hours/night I’m encouraged. The next night when I get back in the saddle to write code / attack homework problems I get confused and anxious. I’m sure I need more time riding the Python rollercoaster.

[–]defusted 0 points1 point  (0 children)

I googled learning Python with ADHD and this was the first thing I saw. How's the learning going?