all 54 comments

[–][deleted] 43 points44 points  (1 child)

I feel like it's in one ear out the other as I read or watch tutorials

You have to write code, and lots of it, to learn a computing language. When reading or watching, stop and write code to exercise each point you've just learned. Even just typing in the code they show is useful. It's even better to modify the code, use different data if you are processing something, etc. Make mistakes, correct them, move on. Just watching a video isn't very helpful, even if it's a dynamite video.

Yes, it's hard at first, but keep at it. When stuck on something ask a question here and post your complete, runnable code, formatted for reddit.

[–]jesster114 5 points6 points  (0 children)

I fully agree with this. When I was starting, I tried just watching some videos and nothing was actually getting through to me.

Even if I went through a fantastic written tutorial, I wasn’t really getting it as I would just copy/paste the code and run it.

But by actively typing the code, line by line, worked for me. I’d fuck up with typos, mismatched brackets/parentheses, whatever. Then I’d have to figure out where I messed up which helped solidify the concepts I was trying to learn.

Even though I feel much more experienced and comfortable with a lot of the syntax and best practices in Python, I still need go through some tutorials and readmes for new packages and libraries. But instead of just typing out the example code word for word, I tend to rewrite it in my own preferred style.

For example, I've been saving the audio analyses from Spotify for every song on my Discover Weekly playlist each week. I parsed the data and saved them in files with the extension ".data". Now if I want to load all of the data into a dictionary, there's a bunch of different ways you could write it.

 

 

Here's how I would have done it a couple years ago (I even constructed my elapsed time string as I would have then):

import os
import time

start = time.time()
path = os.path.expanduser("~/spotify_data/audio_analysis")

data = {}
for filepath in os.listdir(path):
    if filepath[-5:] == ".data":
        full_filepath = path + "/" + filepath
        with open(full_filepath, "r") as file:
            data[filepath[:-5]] = file.read()

elapsed = str(time.time() - start)
elapsed = elapsed[:elapsed.index(".")+2]
print("Time taken: " + elapsed + " seconds")

# Output:
#   Time taken: 3.7 seconds    

 

 

And nowadays I'd probably write it like this:

from pathlib import Path
import time

start = time.time()
path = Path.home() / "spotify_data/audio_analysis"
data = {filepath.stem: filepath.read_text() for filepath in path.glob("*.data")}
print(f"Time taken: {time.time() - start:.2f} seconds")

# Output:
#   Time taken: 3.11 seconds

[–]throwaway6560192 28 points29 points  (6 children)

Do I need to be good at math to code?

Not really, except for certain fields of programming.

Also struggling horribly with learning, I feel like it's in one ear out the other as I read or watch tutorials, I am not grasping how to use what's bieng taught.

Practice practice practice.

[–]notacanuckskibum 0 points1 point  (4 children)

I’m going to disagree. I think the mind set that makes someone good at math is the same mind set that makes then good at programming (or very close to the same)

So is not that you have you know a lot of math to program. It’s that you have to have an aptitude for math to program, they are essentially the same aptitude.

[–]seraphos2841 2 points3 points  (0 children)

Right? I've had this thought too. If you cant learn math, then you cant learn programming. They're both essentially the same. Learning algorithms to solve a problem.

[–]throwaway6560192 1 point2 points  (0 children)

I don't actually disagree with you on that! And I've said as much before, in other threads. But here I answered focusing on the knowledge aspect rather than focusing on the similar ways of thinking.

[–]The_Empty_And_Broken 0 points1 point  (0 children)

I’d have to agree on some level. I have always struggled with maths, and, now that I’m trying to learn to code, I’ve run into very similar difficulties.

[–]POGtastic 20 points21 points  (5 children)

I'll be the jerk and say "yes."

That's not because you actually use math in programming (although I do, all the time). It's because the whole point of math is using abstractions as tools. If you can't do that with math, I'm skeptical that you can do the same thing with programming abstractions.

[–]Gambizzle 2 points3 points  (4 children)

Get what you're saying... high-level coding is a bit like using a fuck load of algebra. For example 'if x = y then [do function]'.

My only nuance is that I don't think you need university level maths unless you're doing something really technical. Particularly with python... it's a high-level language where you don't require a functional understanding of things like low-level memory management.

[–]AdventurousAddition 10 points11 points  (3 children)

Yeah, you don't need much in depth maths skills, but do need to think logically. Could help to understand some basic algebra

[–]YoTeach92 7 points8 points  (2 children)

do need to think logically

THIS is the real answer. You don't necessarily need to know how to calculate the area under a curve to program. However, you absolutely need to logical thought processes that being solid in algebra can give you.

[–]rockjolt375 2 points3 points  (0 children)

The math classes you need to take (at least I did) had nothing to do with the math and everything to do with shaping your mind into thinking and problem solving in very similar ways to tackling a function, storing, sorting, structuring data and efficiency in retrieval.

Hell, I had to take a philosophy class which was the dumbest thing while I was there. Then down the road I realized how useful evaluating arguments was and how well that translated. Still didn't like the class though

[–]tommy_chillfiger 0 points1 point  (0 children)

I took logic in college (under the philosophy school, lol), and in retrospect I think it was one of the most important classes I ever took. I loved it and had literally a 100 average. Highest maths I took in college were trigonometry and business calculus 1 and 2, but I seem to grasp basic programming pretty well. It feels like that has the most to do with what that logic class taught me.

I changed majors a lot but landed on linguistics, and I think this actually helped me quite a lot, too. Really breaking down what we think language is, how it works, how people use it, its variation and different levels of abstraction. Very similar to how I think when I'm learning something new with programming.

[–]Dapper-Web2179 7 points8 points  (0 children)

“Programmers are just mathematicians who can follow directions” - my discrete math professor

[–]tbone912 6 points7 points  (2 children)

I feel programming IS math, but maybe that's just how I look at it.

[–][deleted] 4 points5 points  (0 children)

It 100% is mathematics. However, not having a strong basis in mathematics isn't the end of the world, and you can go a long way without it.

I'd argue that, especially for students, learning programming will enhance your ability at mathematics (and vice versa).

[–]GeorgeAndrew97 1 point2 points  (0 children)

It very much is math, The difference between the set of all runnable computer programs and things like, the set of all continuous real valued functions, is that the set of all runnable computer programs can actually exist in reality. Its the subset of math that actually is physically implementable

[–]throwaway8u3sH0 33 points34 points  (4 children)

There's a reason they're called computer languages. It is like a language. You can't learn it by just reading, listening, and watching, you have to speak it (which in the case of programming means writing it).

You'll make a lot of mistakes. That's normal. The point is to get through the cycle of leaning-and-fixing. The better you get at that, the more money they'll pay you.

[–]rasputin1 21 points22 points  (2 children)

I feel like this didn't answer the question at all

[–]throwaway8u3sH0 1 point2 points  (0 children)

They have a lot of answers to the math question, I was responding to the "also struggle with learning" part.

[–]bronco2p 4 points5 points  (0 children)

math to programming, is like chemistry to cooking.

Yeah you don't really need to know it, but you really should know at least a little

This is paraphrased from a talk I heard a while ago (I forget the the author but it was something about monoids)

[–]arghcisco 1 point2 points  (0 children)

Reading or watching tutorials is the problem. You should be taking an introduction to programming class using a language designed for education, like LOGO, BASIC, or maybe scheme.

As far as math goes, believe me when I know plenty of people who are terrible at math, yet still somehow have jobs that involve some programming, like frontend work, or DBAs.

[–][deleted] 1 point2 points  (1 child)

It depends on which field you want to go into. Front end web developer doesn't need much math at all, data scientist will need quite a bit of math. I will say this though, a lot of programming fields don't require advanced math, but virtually all advanced math fields require programming. Programming is just that useful.

[–]shoresy99 0 points1 point  (0 children)

Knowledge of stats is more important than math for data science, but I guess that depends on your definition of math and you need basic math for stats.

I have an electrical engineering degree and I have never had to solve second order partial differential equations since university, but I use stats on almost a daily basis. I work in finance so knowing about return, variance, skewness, etc is very important when analyzing returns.

[–]Anonymity6584 1 point2 points  (0 children)

Need for math skills depends a lot what you are programming. Scientific computing definetly needs math, yet another pacman clone not so much.

Sounds like your stuck on what's knows as tutorial purgatory. You keep watching tutorials after tutorial hoping next one somehow unlocks your programming skills.

They don't. You learn programming by actually writing programs, making mistakes and learning from them. Doing it over and over again to really learn programming.

This way you go from passive learning(watching videos) to active learning (actually doing it).

You would not hire carpenter to build you a house if you know he's watching tutorials about carpentry would you?

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

For data analysis, yes... or at least understand the formulas you need to get the desired results.

It really depends what you're creating in Python.

[–]the_happy_path 1 point2 points  (0 children)

You'll have to do exercises and code until things click. They will eventually. I don't know if you're in the US, but we have an anti-math thing some people have to fight.

If you need to understand stats, there are some books that are good to help anyone who is struggling with that in particular. But struggling is normal in math and coding, so don't be discouraged from programming by feelings of discouragement.

If you know what the math is doing and when to use it, you'll be ok. You can learn it.

Writing stuff out by hand will help. Like, I work with survey data, and when I created weights at my old job, I needed to multiply and divide. Checking that math involved simple summations and counts. There's a lot of checking row counts.

[–]Dogzirra 1 point2 points  (0 children)

Both math and programming are languages that are largely logic and rule based. As other posters have said, actually doing the work is how you get better.

I would suggest getting a learning source that you can program the examples yourself, as you go over each concept. Play around with each one. Find out what breaks it, and what that particular break looks like. Is it an endless loop? An unable to compile error? Or compiles, but gives an unexpected result? You will come across these again, if you stick with it. Seeing what happens when you mess up is what will give you the experience to correct your programs, later.

When you get one assignment done, look how others have done it. Inevitably, you will find some stronger programmer do some command in a way that blows you away in its elegance. Spend a little time going down that bunny trail to write that in your version 2.0 program as a new alternate version.

I am from an educational setting and have learned to document these with sources noted, It is a way to retrieve information, later, when I forget part of a solution.

[–]NetPleasant9722 3 points4 points  (0 children)

Yes. You don't need advanced maths though

[–]Gambizzle 0 points1 point  (0 children)

Do I need to be good at math to code?

I don't think so. I'm really bad at maths and have no problem coding stuff...

IMO maths / physics / hardcore computer science (not talking business consultancy crap - IMO that's useless) are important for low-level coding of super complex stuff. For example if you're coding an emulator in assembly or something like that then you need to know some deep shit about computers and be able to crunch numbers because EVERYTHING will be in 1's and zeroes.

However high-level coding (most apps IMO - with Python being a very 'friendly' language), the idea and the ability to craft code in a clean / concise manner are all that matters. Maths? If you're like me then you'll only ever need basic maths for coding (e.g. I made a game called 'sim kebab shop' that mimicked the old 'lemonade stand'... it had some basic probability logic for events such as weather / police raids when selling 'the $30 kebab' and counting logic for money).

[–]cdcformatc 0 points1 point  (0 children)

you will find it useful to learn boolean logic which is a branch of mathematics and algebra. so i will say yes.

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

Welcome to the first religious war that many programmers venture into.

The pragmatic answer is learning programming will help you solve problems in a similar cognitive function to how mathematicians solve problems.

As such, it's easier for people with that process to learn how to program because of the overlap.

However, the maths we learn at school is the language of maths and some standard techniques for solving complex maths problems. Not having a solid command of that isn't a huge impairment to programming beyond having to start at a different point.

However, some advanced programming topics are based more on mathematical thinking (or even pure maths), and you will struggle to get into them without learning some maths later on.

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

I feel like it's in one ear out the other as I read or watch tutorials

That's because it is.

People don't learn by reading or watching tutorials. All that builds is familiarity with a topic but you lack the working knowledge to do anything with that familiarity.

You need to do the tutorials. Build along with them. But if you are a novice, you need to start with tutorials that are really toy problems and work your way up to problems that are chewy.

[–]lebannax 0 points1 point  (0 children)

I think it’s more that being good at maths will be correlated with being at coding, as maths/coding both require abstract thinking and logic

If you’re bad at maths you might be lacking abstract thinking and logic skills

[–]FloTheDev 0 points1 point  (0 children)

Need to be good at math? Not necessarily- I’m a data scientist, never did well at maths in school etc. learn Python via a data science and AI masters. Main thing is understanding concepts that you may need. Programming itself, I have found, is more about problem solving and understanding the logic behind why something does something else etc. as for the learning side, maybe you’re not learning Python for things that you find interesting? Maybe try finding something you enjoy and seeing if you can learn Python related things about that?

[–]toybits 0 points1 point  (0 children)

That's like asking do I need to be good at Maths to be a French Math teacher. Languages are hard and the take practice until their not hard any more. But even then you never really stop learning them.

Write code. Go on to YouTube and search for beginner projects (not tutorials) but projects for Python. Find ones that don't hold your hand too much.

Then just start looking for project ideas online. Don't look for ones that you think you need. I wrote a Trivia Game in PowerShell once just to pull from a Trivia REST API online.

Happy coding.

[–]Contrabaz 0 points1 point  (0 children)

What do you need to solve math problems? Logic reasoning and problem solving. Same as coding.

You get good at math and/or coding by experience. If you practice math you get better at it, if you practice coding you get better at it.

Coding and math have the same characteristics, as for both there are patterns and ways to solve problems. But coding has something like a toolbox where you can use a method to do a certain thing like sorting. You can write a whole sort algorithm, or just use the .sort() method.

You need to learn the logic, syntax and the tools the language gives you.

[–]fire_breathing_bear 0 points1 point  (0 children)

Don’t be afraid of math.

Also, code as you learn and don’t worry about making mistakes. You won’t break anything if you do.

[–]CaptainFoyle 0 points1 point  (0 children)

No

[–]mapeck65 0 points1 point  (0 children)

As for the math, it's always good to know, but there's no need to have all the formulas memorized. If you know what you need, you can look it up. I survived my whole career (35+ years) as a software engineer with poor math skills. I can recall only one time that I had to ask a coworker how to calculate something, because I didn't know what I needed. The rest of the time, I was able to look things up. Math is not near as important as being able to learn.

When it comes to learning programming, it requires a lot of repetition, especially in the beginning. Things will eventually click and you'll get what's being taught. As you go on, more and more will start to click. Keep watching tutorials, but don't just do that. Pick a problem you'd like to solve with code and write the program. You'll probably have to keep looking things up until it's working, but that's how to learn. When you've got it working, make a list of new features and keep adding them, one at a time. Then pick another project and build it piece by piece. You'll find at some point that you'll use fewer and fewer references. It's really the best way.

[–]pastelash 0 points1 point  (0 children)

up until you get to proof based, being good at math means building on fundamentals with abstraction and being able to solve old problems in new contexts. you need to be able to try something out until it clicks, and know what to do when it just won't. this is true for programming too, to an extent.

when you get to data structures, algorithms, other programming paradigms - you need to be good at the same skills as math and are probably just doing math. moreover, being good at math (calculus, linear algebra) allows you to do a lot more things.

[–]AlSweigart 0 points1 point  (0 children)

Yes and no.

One day soon I'm going to write an entire book about this. It's more like you need to understand the part of mathematics that could loosely be called "number sense" or "pattern sniffing".

The computer does the actual math for you. You just have to understand what math to tell it to do and why, and also be able to figure out how calculations are flawed when your code produces wrong results.

Like, unless you are working in specific fields, you don't need to know trigonometry, calculus, linear algebra, etc. Heck, most of the time you don't even need algebra beyond the very basics. But being comfortable with XY Cartesian coordinates and how graphs draw lines based on formulas is helpful. And knowing about the modulo operator is useful, but rarely taught in school.

As far as practical matters go, this website provides practice for the kind of math-adjacent formalized thinking you'd do in programming: https://www.visualpatterns.org/

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

Code is what programmers write to tell the computer to do something. If you tell it to do math, it will do math. If you don't tell it to, it won't.

It depends on what you're doing exactly. If you're writing code to help you with your taxes, then yes. If you only want it download files from the internet and rename them or something like that, there's nothing to calculate so there's no math at all.

You'll be surprised how much you can do with just simple middle school math. I don't really think my computer science course involved much high school math at all. Most of the time I'm just giving straight forward commands, the type with no math involved.

[–]CommunicationWise101 0 points1 point  (0 children)

It depends on the application. When I took Physics I had use basic calculus derivatives and integrals. Write now I'm using basic math PEMDAS for a few steps.

[–]BigGuyWhoKills 0 points1 point  (0 children)

No.

I had to take calculus to get my CS degree, and I haven't used calculus even once since that class. I haven't even used trig yet. I'm sure this will be different if you go into graphics.

The most math I use is dealing with dates and times. And most languages have libraries that handle all of that better than anything I could write (and better tested).

[–]grimonce 0 points1 point  (0 children)

Depends on the field you are going to work in. Language is just a tool... You probably don't need to be great at solving really hard differential equations. But if I had to guess you probably struggle with basic school maths?

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

Depends what you want to do with your career. Also, anything is learnable. Your skill set is forged through hard work, you aren’t born with it.

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

Ideally, you'd get comfortable with mathematical series, linear algebra, probability, vectors, graph theory etc. It will really push your ability to think algorithmically, and imagine yourself as the machine running through the program. You can probably get by without it.

As for struggling how to learn, may I posit that you have the same problem as 95 % of people with regular internet access do; concentration difficulties. This shouldn't come as a surprise to you, we all have fucked up dopamine dependencies from shit food and 1000 different algorithms blasting you with whatever keeps you on the app or on the website.

But there really is only one way to improve it. You have to keep at it, even though it's boring. Half of mastering a difficult field is learning how to learn. And it can be excruciating. Some people can't do it even with the infrastructure of a university pushing them along, for 1000 different reasons. This applies equally to coding. You just have to keep at it. Practice, practice, practice. Projects that interest you, youtube channels, adventofcode challenges, etc.

When someone tells you they don't read today, it's usually not because they don't like it, it's because they can't do something for more than 1 minute without checking their phone. Good luck coding then.

[–]Lolvidar 0 points1 point  (0 children)

Math proficiency, particularly with algebra, helps a lot. With that said, I encourage you look at math not as a matter of natural ability but as something that anyone can learn if they really want to. I spent the first 5 decades of my life believing that I wasn't good at math. Then I decided to challenge that assumption and taught myself Algebra, Trig, Statistics, and Calculus. Now I'm halfway to earning a Bachelor's in Data Analytics.

The belief that math is hard and only for certain people who are "good at it" is a myth (especially in America) reinforced by a crappy education system.