r/learnpython • • Aug 20 '24

How effective is using ChatGPT to learn Python?

I want to let all of you know that whenever I'm stuck on a Python problem or question, or if I don't understand something, I use ChatGPT as a tool to give me a solution on how to solve the problem, and to explain what each line of the code means, then I type the code myself even if I were to copy the code from ChatGPT (Not copy/paste it or else I won't learn, just type it down myself and that's how I slowly got better at coding). Most of my Python programming knowledge came from ChatGPT rather than from my tutors at university. I'm not saying the tutors are bad but I'm saying to learn Python or any other language, it's mostly self-taught, the tutors can only give you some ideas or explain to you what each part of the code is trying to say, similar to how ChatGPT explains it, but for most people, programming in any language is self-taught, and using ChatGPT works best for me when it comes to learning Python. What do you guys think? How effective is AI when it comes to teaching you how to code in Python or any language?

3 Upvotes

67 comments sorted by

9

u/LeoMartius1 Aug 20 '24

In my experience, ChatGPT is quite knowledgeable in basic Python and pretty up-to-date

You can think of it as a buddy who knows more Python than you. Like a human buddy, it can sometimes be wrong; unlike a human, it never gets tired of your questions

The best use for learning, I think, is to ask it to explain a concept or language feature. If needed, ask for examples and follow up with more questions. Don’t ask it to write your code for you. If you get stuck, paste your code and ask what’s wrong with it.

2

u/NightCapNinja Aug 21 '24

Yup, thats also what I did, I ask for more examples for the questions I'm doing and most of the time I coded everything myself. If I want to check if I got things right or wrong, I use chatgpt to see whats wrong with my code so that I can understand and learn from my mistakes

5

u/Character_Slip2901 Aug 20 '24

I am learning through online classes and ChatGPT

1

u/NightCapNinja Aug 20 '24

Thats good, but remember if ChatGPT gives you the solution to your code, don't copy/paste it, write it down yourself even if you were to copy the code, that's the way of getting better at it.

0

u/yinkeys Aug 20 '24

Could you please list some of the online classes available for Python lessons

1

u/Dogzirra Feb 19 '25

One source is python.org.

0

u/Character_Slip2901 Aug 20 '24

Sorry, no English version. I am learning from Chinese websites

5

u/that1guy15 Aug 20 '24

ChatGPT and other GenAI chat tools on the market are great for a learning aid; you just have to figure out how you best work with it, kinda like learning how to do a Google search effectively.

Here is a suggested workflow:

  1. try solving the problem at hand on your own

  2. provide your code solution and the problem to ChatGPT and ask if its the best way to solve the issue.

  3. Ask ChatGPT to run its own code to validate its accuracy

  4. compare your solution to the one provided and understand why it approached it differently.

  5. adjust your solution with ChatGPTs recommendation

Anything ChatGPT provides that you dont understand, seems wrong or dosent work, research via google or RTFM to get more details. If any questions or details ChatGPT seemed to miss, paste them back into the conversation and explain why you think ChatGPT is wrong.

Using a GenAI product is just like Stackoverflow, to gain value from the help you must understand what others are telling you and not just copy/paste code.

2

u/NightCapNinja Aug 21 '24

Yes thats what I did, whenever I'm stuck on something or didn't understand something, I use ChatGPT to provide me a solution on how to solve it, if I don't understand a line in the code I continue to ask chatgpt on what that line of code means until I fully understand it, and then I type it out myself, but not copy/paste the code. I also ask chatgpt what went wrong with my code if I made mistakes on it.

4

u/Extreme_Stuff_420 Aug 20 '24

Ignore the naysayers, being able to have a conversation with chatgpt about your code is invaluable

I like to create projects with a python chatgpt and fix errors or refactor the program along the way

It shouldn't be your only source of learning but it's certainly valuable.

1

u/NightCapNinja Aug 21 '24

idk why everybody is against it, but I tend to learn Python more better from chatgpt than asking tutors from my university for help where they explain to me what each line of the code does which sometimes makes me confuse.

1

u/Extreme_Stuff_420 Aug 21 '24

Yeah tutors are hit and miss. I like how with chatgpt you can ask it to explain every line of code and you can keep asking it questions to figure out how the code works

2

u/Ankit1000 Aug 20 '24

If you want to learn I recommend using the Universal Primer GPT for the explanations and GitHub Copilot to actually help write codes, but the Code Copilot in GPT is not halfway bad if all you need is basic instruction.

1

u/NightCapNinja Aug 20 '24

Why use Universal Primer GPT if ChatGPT works pretty much the same way as Universal Primer GPT in explaining Python Code?

1

u/Ankit1000 Aug 20 '24

Primer explains it better( as it does everything) and when you head to more complex topics, it gives you a wider detail. Try it and see. I even used it to teach me how to use Pandas and Numpy.

1

u/NightCapNinja Aug 20 '24

I just tested it and the only problem with Primier is that theres a limit on how much you use it, they told me to try again after a few hours, but for ChatGPT you can use it as many times as you like.

1

u/Ankit1000 Aug 20 '24

Oh I’m a paid subscriber so it’s unlimited. If you want a free one, try Codeium free version as an extension in MS Visual Studios. It’s like GitHub Copilot but the free version of Codeium is pretty decent imo.

1

u/NightCapNinja Aug 21 '24

Does it work similarly with ChatGPT?

2

u/thedarksquaredknight Aug 20 '24

Yeah, it's not bad. I usually write my code first, and then if I run into any problems, I copy my code into ChatGPT and check for any errors. It usually does a pretty good job.

2

u/NightCapNinja Aug 21 '24

I did the same thing too, and it explains to me what I did wrong so I can learn from my mistakes, it is pretty good at teaching.

1

u/thedarksquaredknight Aug 21 '24

Yeah, I don’t really understand the hate ChatGPT gets. It’s been really helpful for me. Obviously just copying and pasting code won’t get you far, but using it to learn from your mistakes while coding is actually pretty useful. Definitely better than spending hours staring at the screen trying to figure out where you went wrong without getting anywhere. I like asking it to generate practice questions and variations of the same question. Like using a while loop instead of a for loop this time, etc. It's really good at that.

2

u/damanamathos Aug 20 '24

I don't have experience with this as I already know how to code in Python. However, ChatGPT is an underrated tool for learning most things. I think you can get more out of ChatGPT through having a discussion about what you think, so rather than saying, "how does this code work", you could try, "I think this code should do ABC because of XYZ, but it isn't, why is that?" That extends to any mainstream topic you want to learn about.

2

u/NightCapNinja Aug 21 '24

It sure is, I tend to understand almost everything in Python very quickly through the use of ChatGPT than to waste my time asking tutors or lecturers for help. Chatgpt teaches the same way as tutors but in a more effective approach

37

u/QuantumCrane Aug 20 '24

Be sure to sometimes write code without the help of chatGPT or copilot. One thing chatGPT can help with is generating problems and questions, rather than answers.

If you are learning a particular feature of python, first go to the documentation and read it. Then write some short examples using the feature. Then fiddle with it. Change parameters to see what happens. Ask questions, and then see if you can answer your own questions by making changes to the code.

For extra practice, ask chatGPT something like this:

I am learning Python, and I want practice using <insert feature here>. Can you make a short quiz about this feature with questions that I can try to answer? And then make a short list of problems that I can solve using this feature, but do not provide the answer.

This will likely be more effective then just asking chatGPT for the answer and then copy and pasting.

1

u/Pyboy8 Oct 03 '25

Ik begrijp je helemaal. Als je bij poging 1 een fout hebt, en zorgt dat chat het goed doet, maakt hij weer een fout. Typ je iets waardoor het beide opgelost wordt maakt hij een derde fout. Als je dan een oplossing typt antwoordt chat: "Je hebt helemaal gelijk. Hier is code die het doet." Maar dan maakt chat de eerste fout weer en begint alles opnieuw.

5

u/dowell_db Aug 20 '24

I find LLMs to be a bit more useful than other rubber ducks because a) they can absolutely know how to achieve what I'm trying to do b) I don't feel bad shaming them into devising a concise solution over their wordy one and c) they can discuss code any time

5

u/JamzTyson Aug 20 '24

LLMs are extremely appealing to novice programmers. With just a simple prompt it can write simple programs that work - no skill or effort required.

The downside is that it gives the impression that the novice programmer knows how to program, when in fact they are in fact very much a novice. When the would-be programmer discovers this fact, it can be disheartening, and give rise to thoughts:

"Why bother programming when AI can always do it better than I can?"

During the journey from novice to intermediate, ChatGPT can become extremely annoying. As programming tasks become more complex, it becomes increasing obvious that ChatGPT does not understand the problem - it does not understand anything. Ask ChatGPT to fix a bug, and it may fix the bug, or it may take you down a rabbit hole that has nothing to do with the actual problem. It can imagine (hallucinate) libraries and commands that don't exist. It can get caught in a loop of non-working "solutions", returning to the same error time and again. It can say things that are simply wrong, but with great confidence and insist that it is correct.

A major problem at this stage is that the student programmer does not yet know enough to know when ChatGPT is right or when it is wrong, or why it is wrong when it is wrong. Despite this, ChatGPT can still be a useful source of suggestions, provided that the user is fully aware that ChatGPT is constructing answers as a kind of "word salad" * and does not actually understand anything.

As developers become more experienced, they become more aware of ChatGPTs strengths an limitations. ChatGPT has access to a huge amount of information, and is able to suggest approaches and libraries that can help with problems. In this respect it can be treated as an easy to use search tool, and the developer understands that its suggestions are no more reliable than an opinion voiced by some random person on reddit.

Overall, ChatGPT can be a useful tool for developers, but I do not consider it to be an effective learning tool. It is a tool that the developer has to learn how to use effectively. It can save time with simple, well defined tasks, but it is essential that the user is able to recognise when it is wrong.


* "Word salad" may be a bit misleading. ChatGPT doesn't just randomly string words together; it constructs sentences based on a probabilistic model, trained on a vast amount of language data. It aims to produce text that is coherent and contextually relevant, but lacks any true comprehension, which can lead to errors, oversights, and misinformation, especially in complex situations.

1

u/Canned_Sarcasm Aug 20 '24

I hope it can teach better than it can code.

1

u/NightCapNinja Aug 21 '24

It sure can, I understood almost everything by using it rather than to ask tutors and lecturers for help. It teaches way more better than the tutors I had at uni

1

u/ImmediatelyOcelot Aug 20 '24

If it's working for you, what's the problem? Are you talking about real-life problems and questions you meet or school exercise ones? You will eventually hit a ceiling where GPT won't find anything remotely similar to the specificities of your real-life problem, and that's where it will start halucinating.

1

u/NightCapNinja Aug 21 '24

I'm talking about my university exercise Python questions.

1

u/ImmediatelyOcelot Aug 21 '24 edited Aug 22 '24

Everything that is already "there" in the training data the GPT will be able to sort and spew in a coherent way, anything that is really new it will start just extrapolating on the data it has and it will be hit or (much likely) miss. And the problem is the "miss" is stated confidently as if it's a hit, so you'll never know. The more you get close to fresh real-life problems, you know, the ones that really matter, more useless it becomes. But don't believe me, just keep on going

1

u/yaxriifgyn Aug 20 '24

if I don't understand something, I use ChatGPT

The key question you must ask yourself is "Do I understand the thing after I use ChatGPT?".

If the answer is "Yes", then go ahead. Otherwise, you have not learned how to deal with the problem you were facing.

When you are planning to make a career using Python, you can't use ChatGPT to solve basic issues with the language, just as you can't use a dictionary to talk fluently.

1

u/NightCapNinja Aug 21 '24

If I still don't understand it, I continue to ask ChatGPT until I understand it.

1

u/BIKF Aug 20 '24

One skill a software developer needs is the ability to read and understand code written by others. That can be more difficult than writing code yourself. Maybe that is something ChatGPT can help you work on. When you ask ChatGPT to give you a piece of code, how do you determine if what ChatGPT gave you is good or bad?

1

u/NightCapNinja Aug 21 '24

I'm only in my first year of university taking an introduction course about coding in Python. And when I ask ChatGPT to give me a piece of code, I ask them to explain what each line or part of the code means, after I understood it, I type it down myself without looking, and then check again to see what went wrong if I do made a mistake.

1

u/null31415 Aug 20 '24

I have not been using AI tools until a few days ago. I started using them exactly for that purpose, to learn Python. And honestly, it's great.

You need to know what questions to ask, how to phrase them, how to help it give you a broader picture, and then zoom into specific components. Compared to non-ai assisted learning I learned more in 3 days with AI than I would learn in 10 days without it.

But, I'm not someone who is starting with programming, I have other skills with other languages. So how helpful AI would be for someone starting from scratch. And perhaps a structured tutorial might be better for start. But definitely include AI along the way.

1

u/NightCapNinja Aug 21 '24

Yup, I also tend to learn more from AI than asking tutors at my university for help. Because once when I asked a programming tutor for help with my code, they explained it to me and I got extremely confused, but when I ask Chatgpt for help, I understood it straight away and even if I don't, I can continue asking AI to explain to me what each line or part of the code means, in order to get a better understanding of it.

1

u/ninedeadeyes Aug 20 '24

Very effective.. i am quite sure i am banned on stackoverflow because i asked too many dumb questions whilst chatgpt doesnt judge u and u can always rewrite in a different way if it doesnt get u

1

u/NightCapNinja Aug 21 '24

Also using StackOverflow can sometimes be tough to understand other users comments or what they are saying when they're trying to explain it to you.

1

u/Nishtha_dhiman Aug 20 '24

ChatGPT can be a good way to learn Python, especially if you want quick answers and examples. It helps you understand concepts easily, write code, and learn at your own pace. But, along with this it is also important to practice and follow structured courses. This can further improve your learning.

1

u/NightCapNinja Aug 21 '24

Ik, I use chatgpt to learn Python and then I practice in my spare time to get better at it.

1

u/Brief-Translator1370 Aug 21 '24

Even when it's perfect, it's basically just asking someone else to do something for you. Having someone explain it to you does not usually translate into you being able to understand the concept and do it yourself next time.

1

u/NightCapNinja Aug 21 '24

But it is still a great tool to help with learning Python so that next time I can do better.

3

u/Consistent_Chapter26 Aug 20 '24

If you rely too much on ChatGPT, you might convince yourself that you understood the process because ChatGPT explained it to you. However, when you try to solve a slightly different problem on your own, you may struggle and end up asking ChatGPT for the answer again. This type of learning is called the illusion of competence.

To truly assess your understanding, you need to solve the problem on your own, using your own strategy and style. This is where you can gauge how deeply you understand the topic. If the problem is really hard, try viewing it from a different perspective, taking a nap, or having a short walk. Based on experience, these approaches can sometimes help, and an idea on how to solve the problem may unexpectedly pop up. If you’ve put in significant effort and still find the problem too difficult to solve, then it might be a good idea to ask ChatGPT for help.

5

u/oclafloptson Aug 20 '24

I test chatgpt every few months to see if it's getting any smarter. It always gives me broken code. What's the killer is that it's often code that runs but performs incorrectly in some way. Db connection goes to memory instead of specified .db file, incorrect parameters/arguments passed into methods, one time it had just randomly thrown a .clear() on a list post-comprehension leading to total loss of data. I mean, all of this is easy to fix if you know what you're doing... But learning from it?

7

u/Puzzleheaded_Tree404 Aug 20 '24 edited Aug 20 '24

It's a terrible way to learn.

Ignore the code and think of the steps required. Code is just syntax. It's the process that's actually important.

Reading explanations of each line of generated code is the exact opposite of what makes you better. You don't develop thinking skills, you develop memorizing skills.

If you cannot develop a flow before you code, you don't understand the problem. That in itself is the biggest problem.

2

u/HK_0066 Aug 20 '24

ask him to generate tough logical questions for u then solve them : )

2

u/ZelWinters1981 Aug 20 '24

It's not. Use reference manuals written by humans.

3

u/greebly_weeblies Aug 20 '24

It's terrible.  

Think of ChatGPT and similar as the world's most complicated autocomplete. It doesn't know anything, it's just estimating what you want by looking at what has happened previously.   

That means if it's a known thing it can regurgitate the answer correctly, but the more you want to deviate from what has been seen before,  the less accurate the answers will be. But it'll look convincing as hell, so you'll then have to work out why and where it's broken. And chances are the 'broken' part is the critical functionality you're interested in, all wrapped up in a magic function it cannot and will not supply.

2

u/supercoach Aug 20 '24

It's fucking terrible. Chat GPT is not smart and has no clue how to code. It's a pattern matching trick that works sometimes.

You will develop bad habits and get no real understanding of what you're doing by following the hallucinations of an AI. You need to be able to understand when it has generated garbage code before you can safely use it to assist you and you won't know that until you've got experience.

There's no way to fast track your competence, just persevere and learn to read documentation and steer clear of AI assistants until you've got at least a year of professional quality coding under your belt.

I know it doesn't make sense right now to do what I've said, so you've just got to trust me. Every experienced programmer who has tried AI can tell you the quality of code it produces is questionable. Until AI can actually understand a problem and not just rely on matching patterns, it will produce unreliable results and teach bad habits.

Everything AI teaches you is in the most common results it hits in its matching algorithm. This includes bad habits of newbie coders and outdated techniques that have been superseded. If it has never encountered your problem before, it will imagine helper libraries that don't exist to magically perform the tasks you need.

1

u/[deleted] Aug 20 '24

Works for me. But I prefer cursor and will be trying qwen 1.5 7b next. The most annoying thing is that they often have outdated api info so you have to rewrite that yourself.

1

u/Critical_Concert_689 Aug 20 '24

using ChatGPT works best for me when it comes to learning Python.

I think you answered your own question. Everyone else here who might disagree can piss right off, since they're not learning for you.

1

u/mattynmax Aug 20 '24

Ineffective.

1

u/aplarsen Aug 20 '24

You aren't learning anything

1

u/NoClaimCL Aug 20 '24

you are learning chatGPT and prompting, not Python nor programming

1

u/camilla-g Aug 20 '24

I recommend the following books by Chris Roffey to learn Python Programming: (1) Coding Club Python Basics Level 1; (2) Coding Club Python Next Steps Level 2; (3) Coding Club Building Big Apps Level 3; (4) Programming Art Supplement 1; (5) Interactive Adventures Supplement 2. Kids are learning Python Programming with these books.

1

u/589ca35e1590b Aug 20 '24

I would recommend trying StackOverflow or just looking things up but that's just my preference

1

u/tiikki Aug 20 '24

ChatGPT and all other large language models are horoscope machines. They produce a plausible sounding text, but all connections between text and reality are by happenstance.

1

u/Creative_Pie9363 Sep 20 '24

I wont say that chatgpt is mid but i found claude and gemini way better. Try using tools like google colab which has gemini assistance and qolaba which has all of these models. If you are stuck at a problem just attach a file in the knowledge base.

1

u/Federal_Restaurant29 Jun 11 '25

So I ended up using chstgpt to generate a (ai copilot) basically but I'm wanting to remove the ai fingerprint and implement my own from the ground up can chatgpt actually help me with refactoring the whole program into my own logic? While still teaching me more into how to develop it?

0

u/[deleted] Aug 21 '24

[deleted]

1

u/NightCapNinja Aug 21 '24

The most important thing I must do first is understand and learn Python through the use of AI or any other online websites. I'm only at university doing an introductory Python course.

1

u/[deleted] Aug 20 '24

[removed] — view removed comment

1

u/NightCapNinja Aug 21 '24

If it's teaching you something, you should be able to understand it in order to solve a similar question the next time.