/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
Hi,
So I have been working on this practice in java, I am trying to display content in a linked list that I created by adding objects read from a file. The addToStart method works I have checked when debugging so is reading the file but still my display methods only display one node, the one that is read last which would be the head in my list. Even when I create a random list and call the method, it still does not work. Here is the code for my display method
public void showContents() {
CellNode t = head;
System.
out
.println("The current size of the list is size: " + size + ". Here are the contents of the list");
while (t != null){
System.
out
.print(t.getPhone() + "------->");
t=t.next;
}
System.
out
.println("X"); // Indicate the end of the list
}
Please any advice would be appreciated. Thank you!
Hi everyone! 👋
I’m an experienced software engineer with over 10 years of professional experience in building software, solving complex problems, and mentoring aspiring developers.
I’m offering personalized, in-person coding and software engineering sessions designed to help you:
✅ Master foundational and advanced programming skills.
✅ Tackle challenging coursework or side projects.
✅ Prepare for tech interviews and land your dream job.
✅ Build real-world coding confidence.
Why Learn with Me?
🔹 Hands-on, practical learning tailored to your goals.
🔹 Guidance in Python, Java, Web Development, Data Structures, and more.
🔹 Real-world insights from years in the tech industry.
🔹 Sessions structured for beginners, intermediate coders, and aspiring software engineers.
📍 Where: Near UC Irvine – flexible local meeting spots.
💻 When: Weekday evenings and weekends (customized to your schedule).
💰 Cost: $40 per hour.
🖱️ Ready?
Reach out for more details and availability.
🌟 Let’s level up your coding skills together! 🌟
Hey everyone,
I’ve read a lot of posts about people feeling slow at work, but most focus on productivity or focus issues. That’s not my case—I work my full 8 hours non-stop, sometimes even skipping lunch to get more done. On some occasions, I even work overtime when I get at home (without my team knowing) just to speed things up.
The problem is that my lead thinks I’m slow. He’s generally a chill and cool person, and he doesn’t put a lot of pressure on me, but he often seems disappointed with my progress. I frequently hear comments like, “Oh, you’re still working on that? Don’t you think it’s taking too long?”
I’ve reflected on this, and I admit that compared to the other member on the team, I am slower. But here’s the frustrating part: I’m genuinely putting in the effort. I work nonstop, put in overtime, and still struggle to keep up. It’s not that I don’t know what I’m doing—I do. I make progress, sure sometimes i get stuck but most of the time I'm not stuck i am progressing but still slow
Honestly, this is starting to get to me. I’m not offended by the comments, but I’m frustrated with myself because I feel like I’m failing to meet expectations, no matter how hard I try.
It’s worth mentioning that this is my first job. I’m five months in, and before this, I worked as a freelancer. This is my first experience in a company setting.
Have any of you faced similar challenges? Is there some things that we can do to become more fast at coding? I’d really appreciate any advice or shared experiences.
I just learned that you can actually do VS code in the browser. See a lot of benefit to this mainly being you can have your IDE be universal regardless of how you access it. But I feel like there's bound to be drawbacks or else everybody would use it. Anyone have experience with this and share the pros and cons
In my case, I can render my component that should have a chart, but the chart itself is not rendering at all. Data is being passed into it, but the responsive container (which I've had to mock as a div to give it a fixed height/width) is always empty.
How do I balance time with highschool extracurriculars and APs with learning a language after school. How much time should I'd dedicate to learning/practicing and other hobbies?
My current laptop is "Acer Nitro V" from 2019 and I'm thinking if I should consider buying a new one, maybe the 2024 version if it? What do you think?
Hi everyone, I am based in Toronto and here i barely see jobs related to nodejs in backend. Though I have strong command in it but i feel like it is getting wasted. So should I now learn dotnet or stick to it? I am confused
Hi. I have a problem and I need guidance, please.
I want to start by saying that clearly what is not allowing me to move forward as I would like is my lack of knowledge of fundamental things related to programming and working with relational databases, plus not being “tech savvy” in general. BUT what I think is going to help me move this project forward is that I have sincere intentions to learn, now and in the future.
But again, I need some guidance.
Well. I was given the task of automating a weekly report. This contains summaries and graphs of data collected during that week (which is located in a database and from what I understand is accessed through an Azure data explorer cluster), plus information extracted from a pivot table in excel that has to be cross-referenced with other data in Azure. All this put in a neat and professional way in a PDF, for presentation.
What things do I understand to some extent? Well, I am going to work with python in VScode, as I know how to work the tables and get certain calculations done (pandas, matplotlib and numpy). I am looking for a way to make the data extraction from Azure automatic (maybe someone can throw me a hand here too).
I asked this question originally in a sub about Azure, because I feel it is the part where I have the least knowledge, but i would appreciate any help really. Maybe all I have to do is extract the data to an excel and start working from there, I sincerely don't know.
Hi everyone,
I’ve been working on a problem involving address space sizes, and I want to confirm if my understanding and calculations are correct. Here’s the problem:
We’re given:
I’ve attempted the solution as follows:
The number of pages in the logical address space is 256, so to represent 256 pages, we need:
Bits for Page Number = log₂(256) = 8 bits.
The page size is 4 KiB = 2¹² bytes.
To represent the byte offset within a page, we need:
Bits for Page Offset = log₂(2¹²) = 12 bits.
Total Logical Address Bits = Bits for Page Number + Bits for Page Offset = 8 + 12 = 20 bits.
The number of frames in physical memory is 64.
To represent 64 frames, we need:
Bits for Frame Number = log₂(64) = 6 bits.
The frame size is the same as the page size (4 KiB = 2¹² bytes).
To represent the byte offset within a frame, we need:
Bits for Frame Offset = log₂(2¹²) = 12 bits.
Total Physical Address Bits = Bits for Frame Number + Bits for Frame Offset = 6 + 12 = 18 bits.
Can someone confirm if these calculations are correct, or let me know if I’ve misunderstood any part of the problem? I’d also appreciate any insights into alternative ways to think about address space size calculations if there’s a simpler approach.
Thanks in advance for your help! 😊
For context, I am a newbie game dev using Ren'Py, an assisted program for making visual novels.
The developer of an awesome game sent me the code so I (a newbie) can learn and study. The files come in three forms: Windows Media Player, RPYC File, and BAK File.
I can access BAK Files just fine, but only a few of the files have that option, most just have the first two. RPYC is gibberish (it's what Ren'Py uses to run) and Windows Media Player just... can't. It isn't a video. I downloaded a better video player and it doesn't work (it's a file. I want the code.)
I'm at a loss. Is there a way to decode a file like the RPYC? Do I have to somehow open the Windows Media Player file on notepad (works for BAK)? Should I reach out to the dev and, if so, what do I say? Any advice welcome.
SOLVED! i deleted all the media players and it'll finally open where I want. Hopefully this doesn't kill me in the future, thank you!
Hi all, I’m new to using vscode and GitHub. As part of my college project, we have to create a game in C++. I was wondering how would I integrate SDL2 to my code space so I could use its header files. And also how would I make the code display an output because as far as I am aware, code space cannot initiate graphics rendering. I also do get an exist status -1 everytime I try to build the code. Could someone please help me with it.
Hi guys,i am a 9 grader from Romania,i have some serious issues with informatics,especially with the pseudocode,I’m unable to memorize those algorithms.Do you have any tips?
Hello. I am in a foundations of software development course and learning to use coral. For my current assignment, I need to run a for loop 12 times while tracking the number of times a random 0 or 1 is generated. The idea is to create a game that allows the user to guess the number of hard boiled eggs in a basket of 12. 0 represents raw, 1 represents hard boiled. I have the loop running 12 times but it is not counting the zeros and 1s. Any help offered would be greatly appreciated! Thank you!
integer numEggs
integer numHardeggs
integer userGuess
integer i
integer numRaweggs
numHardeggs = 0
numRaweggs = 0
Put "There are one dozen eggs in a basket.\n" to output
Put "Some are hard boiled and some are raw.\n" to output
Put "Can you guess the number of hard boiled eggs in the basket?\n" to output
for i = 0; i < 12; i = i + 1
numEggs = RandomNumber (0,1)
if numEggs == 1
numHardeggs = numHardeggs + 1
else
numRaweggs = numRaweggs + 1
userGuess = Get next input
if userGuess == numHardeggs
Put "You win! There are " to output
Put numHardeggs to output
Put "hard boiled eggs in the basket." to output
else
Put "Try again" to output
Yeah, I don't know anymore...I'm sorry, I know what to expect already "why are you even trying to program" or "Then maybe software engineering is not for you".
I've seen videos like "How I code for 4 hours straight" and it's so awesome! but when I try something like that it's so bad that I don't try again.
I couldn't focus for more than 10 minutes, so I gradually upped it to 10 to 15 minutes, then 20 minutes then 25 minutes, and now can focus for up to 50 minutes(I essentially continuously do 10-15-20 minute sessions and a 15-minute break), but not all the time, sometimes I need to take 10-minute sessions with 2-minute breaks to recharge my brain. It works for studying. I feel like that's my max. Anything more than that, I would lose focus and turn my attention somewhere else.
I can't be like other programmers, I just....um, should I quit? Like I am genuinely asking Redditors. I love sketching the problem, decomposing it, and thinking of solutions to problems - but, I just can't seem to get my act straight :( I feel sad.
I can't even sit straight for 2 fucking hours, I'm so frustrated with myself. Just a rant ig.
I'm currently 45 and just had a surgery. My current job is very labor intensive & I'm not sure I can do it anymore. Has anyone gotten a job after using one of the coding/programming courses? I know the bootcamps are 1 way to go, but too costly for me as of now.
Thanks for the replies!
edit currently working in HVAC as a tech/training instructor w/ no coding experience.
I have been programming for about a year now, I’ve always used a roadmap I made to guide me . I was just wondering if anybody else does this or is there a better way to learn and stay on track ?
I'm in my first semester learning java and the last project is really hard. Like some of my relatives are in the industry and they were like yeah it's hard for someone 3 months into it.
The thing is that I struggle to code it. Ik some of my friends who can think and come to the conclusion. A friend is okay w showing me her code. But I feel like if I code it while looking at hers even though I understand it I'm robbing myself of the opportunity to come up w it myself. But I can't come up w it myself. Well I kind of did like what to use and what to do a bit w the help of Google to help me think through it, but to code it out - I struggle.
My mom said it's okay since you're still learning it so you won't know it all....but my friends do? This is so emotionally exhausting and feel so guilty every time I take help from friends and tutors.
Idek anymore. Any advice is appreciated.
I’m split between arm and 100 days of code my dr yu which one would be best for a beginner i would like it to be more hands on if possible
Someone, please explain me what is happening here. Let's assume we have a height of 10, a width of 8, and RGBTRIPLE
is 24 bytes. width * sizeof(RGBTRIPLE)
means that we're getting the size of an entire row of the image's pixels, which in this example, would be 192 bytes. In this example, we have 10 rows, so that would give us 10 of 192 bytes. Where I'm confused, is why is it being stores like RGBTRIPLE(*image)[width]
instead of RGBTRIPLE(*image)[height].
It makes sense that we would wanna store the 10 of 192 bytes we're getting in an array of that size, right?
I’ve completed my first half decent project (a TO-DO app) using html, css and js. I have the basics like a delete button, clear all tasks and edit and the functionality of the app is good.
I’ve been working on it for like two weeks (cuz it took me ages to wrap my head around localStorage) and could continue to improve this app but should I try and build something else instead? What would be more beneficial for me?
Hello! Sorta freaking out a bit here. This semester in college I am doing not so great, and I have a couple years of community college pre reqs and many BS classes left before I even start what I want to do, which is programming in my major.
My motivation just keeps on dying, with each passing semester, and especially as the future progresses. So, is there anything out there that I can reliably either get a proper chance at a job, learn and put my 100% to learn programming and that maths required? I see that Harvard provides online classes for programming, which is good, but are there any pre reqs for that?
Anything with pre requisites will just kill me, due to my horrible performance in high school, college placed me in Development Math, then I failed Algebra 1, passed the second time, and now I'm taking Algebra 2. I still have so many years of maths and classes left, again, before I even think about taking programming.
I'm sorry if this reading is all over the place, but if anyone could please point me in a better direction than my counclers, then I'll be more than happy to listen. I just need an ounce of motivation 😅
Hi.
So instead of complaining like I did here. I decided to take action an actually code. I had this idea to make a Wordle in Java, and I did it with some struggle, but I did it.
I'm a beginner in programming, and I know that some people here will pull their hair off while reading the ugly code, but I'll accept all criticisms from you guys in order to improve.
Here's the code : https://pastebin.com/8WrDJMfG
I have learned all the basic and other java features but i would like to learn hoe to make apps and java servers but i am got getting proper resources online so i would request You Guys to please recommend me some resources from where i can learn those
I am learning Pulp for my decision analysis class and trying to create a script to model several aircraft taxiing from a gate node to a runway node to minimize the taxi and wait times. Where I am getting stuck is adding a time range to the problem so that I can compute the collective hold time for the aircraft (the code runs without error, just that the solution is unfeasible). If anyone would be willing to look at my code that would be much appreciated. Problem definition, objective function, and constraints below. Thank you!
aircraft = ["A1", "A2", "A3", "A4", "A5", "A6", "A7"] # List of aircraft
nodes = ["Gate1", "Node1", "Node2", "Runway", "Node3"] # Taxiway nodes
arcs = [("Gate1", "Node1"), ("Gate1", "Node3"), ("Node1", "Node2"), ("Node2", "Runway"), ("Node3", "Runway"), ("Gate1", "Node2")] # Taxiway arcs
taxi_time = {("Gate1", "Node1"): 3, ("Gate1", "Node3"): 2, ("Node1", "Node2"): 2, ("Node2", "Runway"): 2, ("Node3", "Runway"): 4, ("Gate1", "Node2"): 3,("Node2", "Node3"):1 } # Time for each arc
time_periods = range(1,61)
arc_capacity = {("Gate1", "Node1"): 1, ("Gate1", "Node3"): 1, ("Node1", "Node2"): 1, ("Node2", "Runway"): 1, ("Node3", "Runway"): 1, ("Gate1", "Node2"): 1, ("Node2", "Node3"): 1}
# Aircraft-specific start and end nodes
start_node = {"A1": "Gate1", "A2": "Gate1", "A3": "Gate1", "A4": "Gate1", "A5": "Gate1", "A6": "Gate1", "A7": "Gate1"}
end_node = {"A1": "Runway", "A2": "Runway", "A3": "Runway", "A4": "Runway", "A5": "Runway", "A6": "Runway", "A7": "Runway"}
# Time windows for each aircraft
#time_window = {"A1": (0, 2), "A2": (0, 2), "A3": (0, 5), "A4": (0, 5), "A5": (0,7), "A6": (0, 5), "A7": (0,7) }
# Decision variables
x = pl.LpVariable.dicts("x", [(a, arc, t) for a in aircraft for arc in arcs for t in time_periods], cat="Binary")
w = pl.LpVariable.dicts("w", [(a, node, t) for a in aircraft for node in nodes for t in time_periods], lowBound=0, cat="Continuous")
# Model
model = pl.LpProblem("Minimize_Taxi_and_Waiting_Time", pl.LpMinimize)
# Objective: Minimize taxi time and waiting time
model += (
pl.lpSum(x[a, arc, t] * taxi_time[arc] for a in aircraft for arc in arcs for t in time_periods)
+ pl.lpSum(w[a, node, t] for a in aircraft for node in nodes for t in time_periods),
"Total_Time",
)
# Constraints
# 1. Each aircraft must start at its starting node
for a in aircraft:
for t in time_periods:
model += pl.lpSum(x[a, arc, t] for arc in arcs for t in time_periods if arc[0] == start_node[a]) == 1 #, f"Start_Node_{a}"
# 2. Each aircraft must end at its ending node
for a in aircraft:
for t in time_periods:
model += pl.lpSum(x[a, arc, t] for arc in arcs or t in time_periods if arc[1] == end_node[a]) == 1 #, f"End_Node_{a}"
# 3. Flow conservation for intermediate nodes
for a in aircraft:
for node in nodes:
for t in time_periods:
if node not in [start_node[a], end_node[a]]:
model += (
pl.lpSum(x[a, arc, t] for arc in arcs for t in time_periods if arc[1] == node)
== pl.lpSum(x[a, arc, t] for arc in arcs for t in time_periods if arc[0] == node)
#f"Flow_Conservation_{a}_{node}",
)
# 4. Waiting time constraints
# Waiting time at a node must be non-negative and within the time window
for a in aircraft:
for node in nodes:
for t in time_periods:
model += w[a, node, t] >= 0 #, f"NonNegative_Wait_{a}_{node}"
# 5. Aircraft separation at nodes
# Prevent multiple aircraft from occupying the same node at the same time
for node in nodes:
for t in time_periods:
model += (
pl.lpSum(w[a, node, t] for a in aircraft for t in time_periods) <= arc_capacity
#f"Node_Separation_{node}",
)
Hey, I'm looking for a tutor for DSA. About me: B.E 2019 (Electronics and Telecom) Work Experience: 5 years (Java developer)
Expectations: Some one who can teach DSA from scratch 3 to 4 times a week (Preferably Evenings). Assign H.W and track progess
I'm a mechanical engineer who somehow landed in the IT field, and now my dayjob - amongst other things - involves programming. I am not a computer scientist, and most things I know on IT topics are self taught. But I feel like I'm kind of stuck. Most programming tasks I do for work are not too challenging, since it is not my main task. That is why I feel like I don't make much progress when it comes to my programming skills, which has been frustating me for quite some time now. For me, I feel like I need to create things and apply my knowledge in order to really get things into my long term memory, which is why I learn the most by solving problems myself or building stuff.
But the question is: What? I feel terribly uninspired and don't have any idea for problems/projects that make things fun again. I don't really care about the technology used, I've used different languages over the years (C#, Java, Python, etc.). Are there any resources (websites, books, etc) that have fun projects and problems that could inspire someone like me to advance further?
Hi!, I recently got a bootcamp degree on Full-Stack Developer where I learned the path JavaScript/React and Python/flask but I'm seeking like job simulations programs to get experience and more practice because in this times I think we need get more professional experience to get hired hahaha
I write back-end python code in my job (Django etc). I'm fairly comfortable with Java too, so I understand what it's like to use a strongly-typed, compiled language.
But I am told that learning a language like C++, Rust or even C could help me be a better python programmer too?
I want to mess around with one at the weekend. C++ sounds interesting for microcontrollers, but also many cool products get made in Rust nowadays?
I like the idea of messing around with microcontrollers too.
Have people had a both fun and educational experience with one of those languages?
Please help me , I have no idea I am overwhelmed by the videos on YouTube.