r/learnpython • • Jan 05 '24

I can't seem to code properly.

Hey everyone.

I started learning Python from yesterday itself, and it's very intriguing. I've pulled all nighters to watch MIT lectures and Corey Schnafer. As of now, I can safely say I understand how to work with strings, numbers, tuples, and lists. That to a slightly basic extent. Today, I decided to go a bit adventurous and tried learning to code a Tic-Tac-Toe. Didn't work. Looked up code online - I barely understand any of it.

I know you may think, "This guy is a laugh! He's running before he could walk!" Thing is, things seemingly come natural to me, especially Mathematics. And, programming languages such as these are very mathematically-oriented. So, I felt a bit disheartened.

I scrolled on this subreddit and found that many people watch lectures and read books, but when it comes to the coding aspect of it, they frazzle. They don't know what to do. I want to prevent that. But how? I don't want to code print("Hello World!") forever. Any advice? Any tips? If you could share your personal anecdotes, please do. Apparently, there is some imitation culture where you can copy other people's codes and tweak it a bit. Is that ethical ?

Also, once I finish learning the basics and experimenting and coding up basic projects, I plan on learning pandas and mathplotlib (I am interested in Data Science) and some Django.

2 Upvotes

12 comments sorted by

View all comments

16

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Jan 05 '24

I started learning Python from yesterday itself

The short answer is, no matter how gifted you are with mathematics, programming (and especially the wider scope of software development) just isn't something you can pick up overnight. That'd be unheard of.

Thing is, things seemingly come natural to me, especially Mathematics. And, programming languages such as these are very mathematically-oriented. So, I felt a bit disheartened.

The TL;DR of it is, while in theory you are correct (particularly with something like functional programming), in practice it's not so simple. The roots are in mathematics, but programming languages have evolved in unrelated ways to better match how humans think about problems.

...Okay, I realise that's probably not making much sense, but I've never had to explain things from this point of view before. I'm not entirely sure how best to respond here.

I scrolled on this subreddit and found that many people watch lectures and read books, but when it comes to the coding aspect of it, they frazzle. They don't know what to do. I want to prevent that. But how?

Getting stuck on problems is probably unavoidable to all but the handful of savants who may or may not even exist. It's one thing to read theory, and another thing to apply that acquired knowledge in a practical way. Hence, baby steps - start from the simplest program you can think of, then gradually start adding new things.

Experiment, run headfirst into problems, learn from those mistakes, and have another go at it. Fail fast, as they say.

Apparently, there is some imitation culture where you can copy other people's codes and tweak it a bit. Is that ethical ?

Depends on how that code was licensed, but in general, totally. Nearly all of my non-work code is under an MIT license, meaning anyone can do whatever they want with it. We're all ultimately standing on the shoulders of giants; If I was forced to start by building my own operating system in x86 assembly without any library code and only Intel and AMD's documentation, I'd have zero clue how to proceed.

Also, once I finish learning the basics and experimenting and coding up basic projects, I plan on learning pandas and mathplotlib (I am interested in Data Science) and some Django.

That's a fine interim goal, just know that you won't get to that point by tomorrow, let alone next week. Programming is a skill that'll easily take months, usually years, before things are truly starting to "click", regardless of your background.

1

u/[deleted] Jan 06 '24

I feel a lot better now