/r/learnprogramming
A subreddit for all questions related to programming in any language.
If you need help debugging, you must include:
See debugging question guidelines for more info.
Many conceptual questions have already been asked and answered. Read our FAQ and search old posts before asking your question. If your question is similar to one in the FAQ, explain how it's different.
See conceptual questions guidelines for more info.
Follow reddiquette: behave professionally and civilly at all times. Communicate to others the same way you would at your workplace. Disagreement and technical critiques are ok, but personal attacks are not.
Abusive, racist, or derogatory comments are absolutely not tolerated.
See our policies on acceptable speech and conduct for more details.
When posting some resource or tutorial you've made, you must follow our self-promotion policies.
In short, your posting history should not be predominantly self-promotional and your resource should be high-quality and complete. Your post should not "feel spammy".
Distinguishing between tasteless and tasteful self-promotion is inherently subjective. When in doubt, message the mods and ask them to review your post.
Self promotion from first time posters without prior participation in the subreddit is explicitly forbidden.
Do not post questions that are completely unrelated to programming, software engineering, and related fields. Tech support and hardware recommendation questions count as "completely unrelated".
Questions that straddle the line between learning programming and learning other tech topics are ok: we don't expect beginners to know how exactly to categorize their question.
See our policies on allowed topics for more details.
Do not post questions that are an exact duplicate of something already answered in the FAQ.
If your question is similar to an existing FAQ question, you MUST cite which part of the FAQ you looked at and what exactly you want clarification on.
Do not delete your post! Your problem may be solved, but others who have similar problems in the future could benefit from the solution/discussion in the thread.
Use the "solved" flair instead.
Do not request reviews for, promote, or showcase some app or website you've written. This is a subreddit for learning programming, not a "critique my project" or "advertise my project" subreddit.
Asking for code reviews is ok as long as you follow the relevant policies. In short, link to only your code and be specific about what you want feedback on. Do not include a link to a final product or to a demo in your post.
You may not ask for or offer payment of any kind (monetary or otherwise) when giving or receiving help.
In particular, it is not appropriate to offer a reward, bounty, or bribe to try and expedite answers to your question, nor is it appropriate to offer to pay somebody to do your work or homework for you.
All links must link directly to the destination page. Do not use URL shorteners, referral links or click-trackers. Do not link to some intermediary page that contains mostly only a link to the actual page and no additional value.
For example, linking to some tweet or some half-hearted blog post which links to the page is not ok; but linking to a tweet with interesting replies or to a blog post that does some extra analysis is.
Udemy coupon links are ok: the discount adds "additional value".
Do not ask for help doing anything illegal or unethical. Do not suggest or help somebody do something illegal or unethical.
This includes piracy: asking for or posting links to pirated material is strictly forbidden and can result in an instant and permanent ban.
Trying to circumvent the terms of services of a website also counts as unethical behavior.
Do not ask for or post a complete solution to a problem.
When working on a problem, try solving it on your own first and ask for help on specific parts you're stuck with.
If you're helping someone, focus on helping OP make forward progress: link to docs, unblock misconceptions, give examples, teach general techniques, ask leading questions, give hints, but no direct solutions.
See our guidelines on offering help for more details.
Ask your questions right here in the open subreddit. Show what you have tried and tell us exactly where you got stuck.
We want to keep all discussion inside the open subreddit so that more people can chime in and help as well as benefit from the help given.
We also do not encourage help via DM for the same reasons - that more people can benefit
Do not ask easily googleable questions or questions that are covered in the documentation.
This subreddit is not a proxy for documentation or google.
We do require effort and demonstration of effort.
This includes "how do I?" questions
/r/learnprogramming
While trying to learn how to program using the internet, I would always feel anrgy because there was never a straightforward tutorial. I always need to search on multiple sources, forums, videos. But then I thought and said to myself: "You didn't want to go to college. They probably teach everything you need to know there but you don't want to go. That is why you have to seek so many different sources. If you don't want to pay for college, shut up and keep searching on the internet instead!"
So that is what I am going to keep doing.
Also, I would like to know from those who went to college here, am I right on this thought?
So I'm a 1st year BS Information Technology student and I'm wondering if the app "Programming Hub: Learn to code" is good for learning C (this is the language our program is also teaching us). I am currently struggling a lot with the activities handed to us by our professors and I am not good at creating programs based on the problem exercises they give us. I can't really solve them without asking ChatGPT for help. So I'm thinking of using the app I mentioned to learn more about coding along with the resources our school provides plus the youtube tutorials. Is the app a good help? Or are there better ways (or apps) that can help me with my problem?
hello guys i m persuing CS from SPPU.....i just want to be in a computer field which is related to finance....
correct me if i am wrong ...
DOES BLOCKCHAIN IS RELATED TO FINANCE???
Hey everyone,
I built a small Python program that runs locally and pseudonymizes/anonymizes data. It also has database interfaces, and so far, everything works fine (no crashes or errors š).
Now Iām wondering: How can I make sure itās actually secure?
Iām not an IT expert and donāt know much about āclean codingā or security standards. But since it handles sensitive data, I want to make sure there are no vulnerabilities.
Questions for you:
Iād appreciate any tips you have!
Thanks a lot š
What's the coolest thing you've had happen in your mind during the zen phase of learning? I've recently learned declarative programming, although I still sin with imperative programming, I can't get out of the habit of writing a complete algorithm from scratch. It looks especially dumb when I find a one-line implementation later.
There was an interesting problem (for me) with C and C++ files that was fixed in a way I don't understand. I would love it for someone to explain a little bit how this actually works (and if it's proper usage):
Basically I have C library that needs to run some C++ class's code. But the C file does not include any C++ files.
myCFile.c:
SetSwitchValue( 0 );
myCFile.h:
#include "extern.h"
extern.h:
extern void SetSwitchValue( unsigned char value );
The .cpp files:
Connector.cpp:
#include "Connector.h"
extern "C" void SetSwitchValue( unsigned char value ) {
// some code
}
Connector.h:
extern "C" void SetSwitchValue( unsigned char value );
That's the setup and it compiles. Nowhere in the C source and header files is Connector.h
ever included. When I did add #include "Connector.h"
directly in myCFile.h
without going through extern.h,
there were errors, mainly:
Connector.h:18:8: error: expected identifier or '(' before string constant
18 | extern "C" void SetSwitchValue( unsigned char value );
Why is this the case? Why does one work when the other doesn't? What's happening with the compiler?
Thanks in advance!
(Edited in an error I received).
So, my friend hit me with this: āReal programmers learn from documentation, not tutorials.ā š§āš»
I am not a beginner.
But honestly, I feel like I understand concepts better when watching tutorials. They give me a step-by-step breakdown, and I can follow along without feeling overwhelmed. On the other hand, diving straight into documentation feels intimidating and too abstract sometimes. š but documentation has more content than tutorials .
What do you think? Is it a bad practice to rely on tutorials?
Iām curious about your learning styles?
Do you stick to documentation from the start? Do you mix tutorials and documentation? Or do you have a completely different approach?
Seems like these are both valid ways to build microservices.
TL;DR: I'm a first-year computer science student who's been learning front-end development for two years, but I'm burned out from working on layouts and animations. I want to explore something more engaging with possibility to build huge projects.
Hi, I'm a first-year computer science student from Poland. I've been learning front-end development for about two years, on and off. I know HTML, CSS, and JavaScript well. I also know how to work with SQL databases using PHP and have a basic understanding of React. Thanks to my college and high school, I've learned the syntax and general basics of C++ and Python, though I havenāt tried applying them to practical projects yet. I've just made some easier console apps and solved few leetcode problems with these two.
Over the past few years, Iāve completed many web projects, starting with simple forms, followed by Odin Project exercises like Tic-Tac-Toe, and even larger websites, such as a fully usable gym site with login system or an online store with huge database.
The problem is that constantly choosing matching fonts, centering divs, and adding dark modes has become exhausting. It feels like the only thing left for me is learning more libraries and frameworks to make my code faster and my websites prettier. But creating smoother button animations no longer gives me satisfaction, to the point where nowadays, I only log in once every few days to do one or two LeetCode problems.
Iām the kind of person who loves expanding projects and adding new features. The project Iāve spent the most time on was a console-based RPG game in Python. I worked on it every day for weeks, adding new bosses and weapon upgrades, and to this day, itās the most exciting thing Iāve ever worked with.
Next year, Iāll have to choose a specialization for my college (I don't know about the USA computer science, but in Poland there is something like specialization where you have to choose what exactly do you want to learn). The options are: Software Engineering and Mobile Technologies, Cybersecurity, and IT Systems Implementation. Obviously, Iām 99% sure that I am going to choose the first option since Iāve already spent hundreds of hours coding. Do you think itās a good idea to start learning Kotlin/Java now to prepare for mobile technologies? Or do you have other suggestions for a learning path that could bring me joy and excitement? I have never been good at math and physics, so probably gamedev, or machine learning are not the best ideas for me.
Everything seems to be too dry and abstract, whereas building something which is actually useful helps to understand far better.
I'm not a cs grad, doing for some general knowledge.
I wish to find some more examples alongside:
And such, which can serve both theoretical and practical purposes, tired of generic examples spread all over the internet.
Hello to everyone,
Im pretty new to web dev and working with GitHub(still a learner). I made a project using Node.js using Express.js and i included EJS for templating. I waas working with Axios for aking HTTP requests as well. (It was a homework so i needed to use those technologies)
Im done with project and i wanted to post in on my GitHub account, did everything as i should, but when i opened the link oh GitHub it shows error 404.
Apparently GitHub cant work with EJS because its not a static file?? or at least thats what ChatGPT is saying.
Does anyone have some tips or knows what is the best way to fix this issue?
Thanks in advance all, and sorry for my English.
Hey people, hope you're having a great day;
I wanted to ask which are the best resources out there for learning and mastering python, i started with R since my field would be data analysis and prediction projects (i guess ultimately neural networks [i apologize for my apparent ignorance, that's why i'm here]) but i found out Python has everything R can do and much more.
As of right now i have already taken the Introduction and Intermediate Python courses on DataCamp, i plan to go ahead with Data Manipulation with pandas and matplotlib, to then go for Statistics in Python and ultimately Introduction to Machine Learning in Python; i am also planning to participate in Kaggle tournaments but i just want to make sure this is the right track.
(I have seen the first few videos of CS50, but i don't like my rhythm being dependent on a video, i have my own pace and would like better to learn in the most practical way, i need to see the objective or the functionality of something in order to fully understand; i know CS50 has its own environment and its own mini projects for learning but i need something more dynamic, to me, the best way to learn is by fucking up.)
My ultimate goal is literally to be a problem solver, i want to be able to build projects regardless of the field, be it marketing, marine biology, trading, economics, optimization of any kind, etc. As you can probably guess i am pretty new to this, i barely started this journey on december 10th.
I do not want to discard any alternative, be it learn other languages, go to another platform, or rectify my idea of what i need to do in order to achieve my goal; i live in a country where data science and programming is really neglected and want to show people within my reach how big this field is and how it will be the future of everything, i have always thought that in 5 years, not knowing how to program will be the equivalent to not knowing how to read in medieval times.
All feedback is appreciated, be it negative or positive.
Thank you
Hey guys i am newbie and wanna know that blockchain is really worth learning ??
suggest me a better course with certification
Iāve got an exam in 1 week that I haven't studied for enough in programming 2(python).
I know there are plenty of AI tools made to help you learn things. But Iām not totally sure how to make the best use of them.
Can you share how you would utilize AI tools to learn programming in 1 week? Canvas? Custom GPT's? Specific prompts? I am looking for something that helps you actively learn.
Thanks!
I ve written code in R ( like python). I want non coders to execute it without accessing R through batch file. but we dont have admin right. is there another way?
I hate pointers and need someone to explain this to me
first of all this is pulled from tm4c123gh6pm.h file made by texas instruments for that tiva c model
using Standard C 99
this makes GPIO_PORTF_DATA_R handled as a normal Variable in the code, my issue is, i dont understand how is this done through this pointer configuration
and i want to know how to call suh an address Variable in a function
like for example setBit( * uint32_t DeclarationMightBeWrong , uint8_t shiftingBit){}
and how do i assign it to another variable?
Register* = &GPIO_PORTF_DATA_R; ?
again i hate pointers
Iām building a webapp to create and issue digital passes, and so far iāve got it set up to issue the passes but the custom fields I want to add are added to the back of the pass in the details, and not shown visibly on the front.
Anyone dealt with creating passes with the Google Wallet API? Any pointers would be much appreciated!
I release this is a long shot but I would really love some help! Claude and ChatGPT are both stuck in doom loops trying to figure it out.
Thanks!
Recently started a new role as a data analyst. Although Iāve been writing code since 2020, I still sometimes feel like a newbie, especially when I go back to using a language I havenāt used in a long time. How often are you using Google, GenAI, and what are you generally looking for answers to?
Iām seriously considering of going to a coding bootcamp next year and just started learning python on the sololearn app. Iām currently stuck on a practice test just because it didnāt exactly teach me how to implementing the input().
āTo those learning on that app, be aware of spoiler/solution for the following!ā
Iāve tried everything. So how do I supposed to ask the user for input, storage it in the name variable, and display it on the screen?
It provided two input examples āTomā āBobā With expected outputs being Tom and Bob, obviously.
I wrote like this:
#Ask the user for input and store it in a variable name = input() name2 = input()
#Display the user input on the screen print(name) print(name2)
I keep getting an EOF error. Help! š
I even tried name = input(āEnter your name:ā)
Snake cases too
Edit: These both input() and both print() are supposed to be in new string but Reddit arranged it wrongly. Also these large bold sentences were supposed to be statements lol
Iāve always wanted to learn programing but I canāt find a good reason to. I did my BA in civil engineering but didnāt like it and I sucked at it. So I became an English teacher because I enjoyed it and it was the only other thing I was good at. Iām 35 now and Iām full of passion for making things. For doing something fun and learning new things. I really like music and Iām learning how to olay the electric guitar. Iām learning a new language other than English( First language is Farsi). I love playing video games and at one point wanted to learn C++ to make video games but I didnāt. Now, Iām thinking of learning how to make websites so I can promote and boost my wifeās business.
Iāve been learning Python for a few days and Iām really enjoying it. Iāve been told that Python is an easy and a very useful language to start with. But I just donāt know what I can do with it. How will it ever be useful for me? Should I just go for web development?
class Solution {
public:
int hammingWeight(int n) {
int count=0;
while(n!=0){
if((n|1)==n){
count++;
n = n>>1;
}
}
return count;
}
};
Please tell me why its not working, count + (n&1) will work obviously but why not this? where's the problem? Is there any specific example or just somethinggggg....
Hello all,
I'm a Backend Developer and trying to do some basic projects I've seen in roadmap.sh with Typescript/Node.
Every time I start a project, I know what I can do to handle the program's logic flow. For example, I have to take arguments from the user from the CLI, transfer these arguments to the Business logic, and then transfer the data to the database/write them on a file. I usually approach it like the classical structure:
src
-- config
-- models
-- services
-- utils
index.ts
The thing is, I don't know how to separate these logics to different services/ managers/ utilities/ functions etc. How can I learn this? Most of the project tutorials just simply says "I'll create the ExpenseService" but doesn't tell you why it's a service or a manager. God, I can't even seperate what's a manager and what's a service.
I can't even create a folder structure, and the more I think about it, the more complex it gets. If you read this far, thanks in advance.
I have completed the foundation of both Odin and App Academy Open. I really like the structure of AAO, but it seems to lack in complex full-fledged projects.
So is it a good idea to complete AAO, and then do all the projects in Odin for learning and portfolio purposes? Thanks.
Also, opinions on App Academy Open are welcome from those who have completed it.
I have this homework "problem no. 3" and I have no clue what the correct interpretation of duplicate should be.
"The first number shall be duplicated according to the value of the second number.
A third number shall be created by multiplying the value of the second number to 6
Display the sum of all three numbers using f-strings. Follow the format of the output below:
The sum of all three numbers are sum., where sum is the sum of all three numbers."
if my input is 3,5. Should my output be
3*5+5+5*6
or
33333+5+5*6
at first i thought it was the first one but they used "third number shall be created by multiplying the value of the second number to 6" If they already used "multiply" here why not also the first one instead of duplicate
Hello everyone!
My name is Nicholas, I am 18 years old and I live in England. I'm looking for people who want to learn, share knowledge and work on projects together. I am open to communicate with people from anywhere in the world, but it would be great if it was mostly people from England, as I would like to be able to meet in person in the future.
I'm learning Python and want to improve my skills with others who already know a bit of the language. My goal is to create projects, share experiences and grow together.
Besides Python, I am also interested in Machine Learning and am looking for people who want to get into this field or are already involved in it to work together on projects and share knowledge. I also want to learn and discuss statistics - would be happy if someone joins.
If anyone is interested in Frontend or Backend (e.g. Flask), that's welcome too. This will give us the opportunity to create quality web interfaces for our projects.
I would also like to add that I am not a native English speaker, and by working in this community I aim to improve my spoken English. I am open to communication, and I think it will help all of us to learn and grow together!
I plan to use Discord for communication and collaboration, so if you want to improve your skills in Python, Machine Learning, Flask or statistics, we'd be happy to work together!
If you're interested, drop me a line in the comments or private messages. I would be glad to meet you and start working on projects together!
My discord channel: https://discord.gg/P4BpbPhU
Hey everyone,
I'm a beginner in JavaScript web development and I'm looking for some project ideas to practice my skills. I've covered the basics like HTML, CSS, and JavaScript fundamentals.
I'm looking for something that's not too complex but still challenging enough to learn new things.
Here are some of the things I'm interested in:
Any suggestions or ideas would be greatly appreciated!
Please feel free to share any resources or tutorials that might be helpful.
Thanks in advance!
Currently i just started to learn HTML I'm not sure how long it's gonna take before i can move on the next language which I'm thinking C++ and then JavaScript, i don't really have a fix goal on what project i want to do, perhaps something like web design or making apps or even cybersecurity which i know nothing on that other than i see it everywhere and that is it in high demand, i would also appreciate some resources where to learn for free that contains practice projects.
The Algorithm for finding if a number is prime is pretty easy, that one is just looping through all the numbers up to the square root of that number and checking if thereās a mod that returns 0. To find all primes up to n you just check each number before n 1 by 1 with our prime finding algo. This is O(n^2) time. Seems easy enough. However, My friend has challenged me to possibly do it in O(n log n) or even O(n) time. I am not sure where to begin though. In order to improve the time to n log n which is what Iām aiming for, I need to find a way to either optimize the determine if prime algo, or the algo for looping through the numbers before n into log n time because both of that are O(n) right now. Anything you can tell me to get me started? Like I donāt want the whole algo I just want some hints if that makes sense.
I am in my first year of university and we are doing Java. Itās just a basic intro to comp sci course, nothing I have not already done in high school. I really want to start the Odin project as I have heard a lot of good things but I also often hear itās not a good idea to learn 2 programming languages at the same time. Would it be a problem for me to be doing JavaScript html css on my own for the Odin project and personal projects when university will have me doing Java for school projects or Should I just stick to Java?
Hello. I have a large JSON file with an array of text messages describing specific topic in a simmilar-ish format that looks something like this:
Date: 12.12.2024 15:00
Coordinates: ...
Model: ...
Status: ...
It's written by different people and can be inconsistent, "Date" might be called "Time" or it might be split into 2 lines "Date" and "Time", there might be "-" intead of ":", extra spaces, grammar mistakes ect.
Is there a good way analyze texts to extract relevant data? It needs to be run locally.