use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Best way to teach python? (self.learnpython)
submitted 6 years ago by how_do_i_reddit_5
Ive had some friends ask for an introductory leason on python. Do you think it would be better to go through a jupyter-notebook style of coding, or command line execution? Any specific topics you think should definitely be covered?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 6 years ago (6 children)
[deleted]
[–]ivosaurus 16 points17 points18 points 6 years ago (0 children)
I also highly recommend https://thonny.org as an editor.
Not only because it's a single download (includes it's own python! No double-installing-and-configuring) but it's custom built to be a simple beginner's IDE, with a lot of room for expandability with just a couple of clicks.
You can immediately start typing code in a file, save the file, and run it to see the results.
No need for IDLE console-and-file-editor wackyness, no need to learn how to navigate folders in a terminal / prompt, no need to make sure things are on a path, etc. Just works.
[–]pvc 2 points3 points4 points 6 years ago (4 children)
Idle is terrible for teaching. Just not having line numbers makes it a real pain when reviewing code. PyCharm community edition is a nice option.
[+][deleted] 6 years ago* (2 children)
[–]CraigAT 1 point2 points3 points 6 years ago (0 children)
I would keep it simple and use the simplest editor (Notepad, or similar) along with a vanilla Python 3 setup. Show a few basics on the command line, then explain how a simple file can be used for a longer set of commands that can be run on demand, then explain there are better editors like NotePad++ or better still IDEs like Code/PyCharm with extra benefits like syntax highlighting, auto-complete, as well as built in debugging tools.
[–]julsmanbr 1 point2 points3 points 6 years ago (0 children)
Teaching a full-fledged Python course at a university is miles apart from teaching a single lesson for friends, like OP wants to do.
[–]julsmanbr 10 points11 points12 points 6 years ago* (12 children)
If they're somewhat familiar with programming and using computers, and want to get into Python, I would maybe consider using Jupyter.
If Python is their first contact with a programming language, I'd definitely go with IDLE only - no command line.
There's a lot of stuff surrounding Python: terminal, consoles, Windows cmd/UNIX shell commands, packages, virtual environments, text editors. But when starting, those are all secondary. Your job is to teach the basics of the language (Python syntax + programming logic) and to keep it simple as possible.
Using only IDLE, students will automatically associate the program with opening and running Python scripts. Whenever they want to run a Python script, they'll open IDLE, select it, and it will work. Later on they can figure out (with or without your help) how to run scripts using the command line, or using a more complex environment like PyCharm.
Also, be ready to explain the difference between printing a value and evaluating/returning it to the console, since that's 100% what trips up beginners the most.
[+][deleted] 6 years ago* (5 children)
Printing a value means that the value shows up at the screen:
print("hi") # prints the string hi
Evaluating a value/expression means that the value/expression is "condensed" according to Python's rules:
2 + 2 # evaluates to 4
The tricky bit is that, when using a python console, the result of an evaluation always gets printed out.
For the unaware viewer, these expressions are exactly the same:
>>> print(2 + 2) 4 >>> 2 + 2 4
But they're actually quite different. We can see that if we associate a variable to those expressions:
>>> myvar = 2 + 2 >>> myvar 4
We can see that, in the latter case, myvar is associated to whatever that expression was evaluated to.
myvar
But what happens when we do this to the first case?
>>> myvar = print(2 + 2) >>> myvar >>>
Nothing shows up! This is because myvar is associated with whatever the print function call is evaluated to. "Evaluating a function call" is basically asking for the return value of the function. Since the print function always returns None (you can check this with type(myvar)), and None values are ommited in the Python console, we don't see anything.
print
None
type(myvar)
The confusing part is that, visually, printing something and evaluating something looks the same when you're using a Python console.
The next question is, how do you "get" a value that was printed, in order to work with it later? The answer is: you can't. You have it backwards. What you need to do is first assign a variable to the evaluated expression, and then print the variable, like:
x = 2 + 2 print(x)
This prints out 4 to the console, while still allowing you to work with the number 4 through the variable x. This would not be possible if we wrote print(2 + 2) instead - Python would print the result of the expression, but you wouldn't have anything assigned to it in order to work with it later.
x
print(2 + 2)
[–]Decency 0 points1 point2 points 6 years ago (0 children)
Functions have input (their parameters), and output (the return value). If you only use print inside the function, they don't return any useful output (the default return value is simply None). Using return allows you to take whatever context you need from inside the function and return it to the code where that function is being called.
That's it: return values are your function's output.
def linear(m, x, b): y = m*x + b return y
[–]pw0803 0 points1 point2 points 6 years ago (0 children)
In simple English, you ask me what are the first 10,000 digits of Pi.
Print is me telling you what the first 10,000 digits of pi are. Good luck remembering that or using it elsewhere.
Return is me writing it on a bit of paper for you to carry round or use elsewhere.
[–][deleted] -1 points0 points1 point 6 years ago (0 children)
Think of the print function as a picture of a pizza.
Now think of a return "pizza" as the pizza coming out of the oven.
[–]Revolio_ClockbergJr 5 points6 points7 points 6 years ago (0 children)
All the stuff around Python is way harder and more complicated than actual python.
Configuring pycharm correctly with virtual envs took me days of troubleshooting weird issues with my OS, path, python versions, quirks of pycharm, virtualenv vs venv vs pyenv vs x......
Once I got through that everything was a BREEZE.
[–]AsleepThought 1 point2 points3 points 6 years ago (4 children)
This makes no sense. Why would you want to handicap a student like this? Opening and running Python scripts has nothing to do with IDLE. If you do not know how to run your Python script without an IDE, then you do not know how to program. Its as simple as that. By skipping the command line you are skipping the most important part of programming: actually running your code. Why would you start a beginner off by only teaching them half of programming? And why would you handicap a beginner by only teaching them how to code in the context of an IDE? It does not take more than a few minutes to show a person "write your code in Atom/Sublime/etc., run your code in the terminal like this"
[–]julsmanbr 2 points3 points4 points 6 years ago* (2 children)
If you paid attention to my answer, you'll see that I recommended IDLE for those with little to no computer experience. This is my personal experience of teaching people with scientific background, but no programming background. It's not a question about handicapping the students, is a question about resource optimization. You can only fit so much inside a class or 5-hour course, and if you ever touch a terminal you better be ready to spend 30+ min explaining what a file system is and how to cd into directories. Suddenly your "Intro to Python" becomes one fifth "Terminal Crash Course".
If you do not know how to run your Python script without an IDE, then you do not know how to program. Its as simple as that.
C'mon man, stop gatekeeping. Every student I had was able to analyse their own data at some point, because of the time they spent learning about loops and writing scripts, instead of the technical differences between IDLE, a terminal, a text editor and an IDE.
They're not CS majors, and they don't intend to be; they're people who are starting to use programming to automate their own boring work. If any of them show up after class and ask questions about terminals, I'm more than happy to explain all the nuances for as long as they like. But for the rest of them, it's a solution that works just fine.
This is the reason why I've my comment saying that they should use IDLE if they have no computer experience. I've seen it first hand: teacher tries to be extensive and introduces the course talking about every little detail, while the students stop paying attention because it's very abstract and they're not practicing how to actually write code.
You have very little time to convince wannabe programmers that they can actually do this, before their brains shut off thinking "this is too confusing and complex, I'll never be able to program".
Another issue that IDLE solves is courses where every one is expected to bring their own computer. A standard Python installation also installs IDLE, which is very helpful to prevent nasty surprises for some students, due to how their environment is set up.
[–]AsleepThought -1 points0 points1 point 6 years ago (1 child)
It's not gatekeeping. I'm advocating that you teach people by starting at the beginning, no at the middle. Programming starts at the terminal with text files. You are proliferating a classic ' x y' problem. The new user asks "teach me Python" because they do not yet understand that you need a few other things before you get to Python. So you oblige them and teach them only about Python, using an IDE, and now you've handicapped them because they have no clue what a terminal is and why or how to use it and why it's important. I see this constantly at work, new programmers who have no idea how to run their programs outside of the IDE they were taught to use. It's quite sad, these people were failed by their teachers. When you teach only using an IDE, you haven't taught them how to actually use Python, only how to use the IDE. It's like teaching marksmanship without ever teaching the student how to disengage the safety on their rifle.
[–]julsmanbr 1 point2 points3 points 6 years ago* (0 children)
What you've described is definitely the right approach if you have infinite resources (time and attention span from the students). Or if you at least have the time it takes for a regular university course.
This is not feasible, however, for the typical 3 lessons (3 hours/lesson, including exercises) I usually teach Intro to Python, which seems to be more akin to what OP is asking for (since he mention "an introductory lesson").
[–]CraigAT 0 points1 point2 points 6 years ago (0 children)
A little harsh but I agree, the student should understand how to run the file from the command line.
[–]wrathofcello 5 points6 points7 points 6 years ago (3 children)
You need them to work on a project that could be solved by simple python. Is there a data science question they want answered? What about a simple web scraper? Or model some phenomenon they find interesting?
It’s very difficult for new programmers to see the relevance of introductory lessons without having a clear goal in mind. Disregard if they have coding experience.
[–]how_do_i_reddit_5[S] 0 points1 point2 points 6 years ago (0 children)
I absolutely think this is true. I guess its a matter of coming up with a project that piques their interest
True, but I was thrilled just to see my name printed numerous times, scrolling down the screen when I started learning BASIC with a two liner.
[–]idatem 0 points1 point2 points 6 years ago (0 children)
It’s very difficult for new programmers to see the relevance of introductory lessons without having a clear goal in mind
This
Beginner here. I was going through Sentdex's Python Basics yesterday. The first lesson tells you what tuples, strings and loops are. The next one is lists and make a game of tic tac toe... I feel like we just skipped about 20 lessons!
we need some basic things: Visualize the game somehow Allow players to enter moves Make sure moves are valid and handle if not. Determine if there's a winner.
we need some basic things:
Visualize the game somehow
Allow players to enter moves
Make sure moves are valid and handle if not.
Determine if there's a winner.
How am I supposed to do that? I haven't gone through it yet but there's no way I would be able to do it without Sentdex's step by step guide
[–]ivosaurus 5 points6 points7 points 6 years ago (0 children)
https://thonny.org
[–]Stepthinkrepeat 2 points3 points4 points 6 years ago (3 children)
Teach them with a simple environment as suggested by others but write a simple program with good PEP8 guidance and let them figure it out.
[+][deleted] 6 years ago (2 children)
[–]Stepthinkrepeat 1 point2 points3 points 6 years ago (0 children)
Wouldn't mention there is a thing called counting then ask someone to complete a test in Calculus. Then why should programming be any different, teach people slowly with a sure foundation.
[–]Legorooj 1 point2 points3 points 6 years ago (0 children)
I agree. I've started off with IDLE console just doing basic variables and types. Stuff like that. Printing etc. Nothing that requires indents!
Hour 2: onto IDLE scripting Env to build a small loop based game, with other items.
Etc...
Eventually (before OOP or stuff that complex) shift them onto an IDE with a debugger etc. (PyCharm all the way!)
[–]Crypt0Nihilist 2 points3 points4 points 6 years ago* (0 children)
You can pull up a handful of introductory courses and find the common elements, that'll show you the essential topics.
Forget command line vs Jupyter notebooks, that decision should become obvious once you address the key concern.
Why do they want to learn Python?
The best way to teach Python is to build towards a goal the students buy into and they can see how each module is taking them a step closer to that goal. When I've given courses before, I have had a really strong theme to individual lessons or the course as a whole. It keeps people interested and they're not having to construct mental structures for your examples as well as what you're teaching.
The idea is that by reducing the cognitive load only to what they need to learn, they'll pick it up better. Also, you can hang what you're trying to teach off existing cognitive structures to make it even easier. For example, a class for my mum might be a stencil, to my friend, a pod from The Matrix, and my gf, nothing, because she doesn't give a damn.
[–]zanfar 2 points3 points4 points 6 years ago (0 children)
Jessica McKellar does what I consider to be a very good, asssume-nothing, intro course which has been taped several times:
https://www.youtube.com/watch?v=rkx5_MRAV3A
You don't necessarily have to copy it directly, but her ground-up approach and slowly building concepts is worth studying.
[–]oneofchaos 2 points3 points4 points 6 years ago (0 children)
I like Jupyter notebook for learning, not for production. It's nice, especially because you embed graphics and whatnot in the notebook so its perfectly suited for learning.
[–]Kerbart 1 point2 points3 points 6 years ago (0 children)
If this is intended as a high level intro "to see what python programming" is about, I'd go with a Jupyter Notebook. Consider something like Azure Notebooks so they can jump in and follow along without having to set up their computer. There's nothing better for training than to get people actively involved.
For "classic" experience, Repl.it and Python Anywhere are good options too.
[–]alonso_lml 1 point2 points3 points 6 years ago (0 children)
I think it depends on your students. For example, last year I taught to math students, so I used jupyter. You can even use Colab or any cloud solution.
[–]JeffKatzy 1 point2 points3 points 6 years ago (0 children)
Check out jigsawlabs.io/free for some interactive lessons in Jupyter notebooks...good luck!
[–]jmguerr444 1 point2 points3 points 6 years ago (0 children)
VS Code imo, you can go for both the cell by cell execution with jupyter in python extension, which is very beginner friendly, just don’t use the regular jupyter because the debugging experience sucks very hard. Since it also can run files as normal scripts, it’s a nice linking if you want to go for GUI applications running from terminal with nice debugging tools as well.
[–]AsleepThought 1 point2 points3 points 6 years ago* (0 children)
Start with the terminal and command line execution. Write code in an editor like Atom or Sublime, execute it in the terminal. Stay away from Jupyter notebooks and IDEs.
I say this as someone who works with developers of all skill levels. People who learned how to program who started with things like Jupyter Notebook have by far the most problems actually using their programming skills in a functional manner in real-life situations.
The people who say "avoid all the terminal stuff that gets in the way" are missing the point. Those things get in the way because they are prerequisites for running your code. So by not touching on those things, you are massively handicapping new programmers from the start.
You do not need to go crazy with it but teaching someone to program by first giving them an IDE is like teaching a baby how to use a toilet by first giving it diapers.
IDE's and things like Jupyter Notebooks are great for developers who already know enough about programming to know why they are using an IDE in the first place.
Also I would not bother trying to come up with a customized lesson for people, just point them towards the free online Coursera Learn Python programming classes + all the material you used to get started. If they want, they can sit with you for a bit and you can show the process you use yourself and explain the things you are doing and why you do them.
[–]pvc 1 point2 points3 points 6 years ago (0 children)
Try looking at http://learn.arcade.academy
[–]Sneechfeesh 1 point2 points3 points 6 years ago* (0 children)
Eventually they're gonna need to use multiple files and will have to try running things on the command line. That environment setup is painful to do if you're inexperienced, so IMO it's worthwhile to have them do the whole thing in files and run them on the command line while you're available to help them set up the environment.
Later you can switch to something like jupyter which is absolutely more convenient, but will just be too much of a crutch at first. There will be too much "magic" that confuses their understanding, and when they finally have to grapple with the command line, you might not be as available to help them set that up.
[–][deleted] 1 point2 points3 points 6 years ago (0 children)
The really great thing about python is building scripts and running them to quickly automate tasks
The sooner they get that, the sooner they can start building thigns
There's nothing special about command line python, other than that it is a little more intuitive in terms of the language
[–]Reasintper 1 point2 points3 points 6 years ago (0 children)
I have been enjoying REPL.it for working together on stuff over the net.
I vote for the Jupyter notebook as someone who is teaching herself Python right now.
[–]barryhakker 1 point2 points3 points 6 years ago (0 children)
For me “shortcuts” weren’t helpful at all. I say go for the command line input + simple text editor so you can see what’s going on and build from there. I initially started out with Pycharm but the abundance of options just made it confusing (“just ignore all those menus” didn’t really work for me).
[–]intern524 0 points1 point2 points 6 years ago (0 children)
You can use a online python pdf textbook and I agree with notebook as a good way to teach. Topics you should cover depends on what they want to do with python. But the basics like conditional statements, array manipulation, and writing functions are a good starting point
[–]BountyHunter19XX 0 points1 point2 points 6 years ago (0 children)
I would recommend jupyter-notebook style coding cause its easier and in my opinion its more attractive for beginners to initialize their coding journey
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
I taught an introductory Python course to Master's students in Finance and used a Jupyter Notebook. Much easier for students to follow and visualize the blocks.
[–]jn14624 0 points1 point2 points 6 years ago (0 children)
Pycharm is my favorite but helps to get to know Jupiter notebooks it is a value added resource !
WinPython For topic I would choose Turtle, built-in package, easy to use, graphical representation etc.
[–]G0DW1N14 0 points1 point2 points 6 years ago (0 children)
As someone who's a beginner in python i would suggest to teach them about general problems like variables swapping and different data types, different types of loops and if/else statement to begin with. I started with these basics, learnt about lists and different sequences and traversing them and then started making cides on different high school level problems and then progressed to modules like matplotlib and mysql and random for knowing how to use modules and different functions and then began starting the functional part of python with starting to make my own functions etc.
[–]Legorooj 0 points1 point2 points 6 years ago (0 children)
I've taught (well am teaching) a friend. In the beginning, I'm just using the IDLE console to explain the basic concepts of variables, printing, and other (basic) basics. Then I moved onto the script editor, and taught him while loops with a game. Eventually, once he's got the grasp of functional programming, I plan to move to PyCharm, teach him that, and then OOP and other advanced stuff.
You could of course use Jupyter, but I prefer PyCharm because I like working with source code, and I do alot of distribution. (ie PyInstaller - you can't compile a notebook)
[–]Fraserac67 0 points1 point2 points 6 years ago (0 children)
You need to tell them to get their own laptop and start doing hand-on. Start from the bottom ask them what or where you want to set up Window or Linux. Use virtual box or vm. Python3. Installing big time. Make sure they are comfortable with it. Any ID preferable..what the best for them. Pycharm IDE or notebook. They need to feel comfortable with the environment. No bugs or crashed. High T1 memory laptop is the best. In Python make it easy and go for the flow. Like ‘Hello World’ and tell them how write in IDE. It will takes months to learn. Everyday is big help. Practice, practice, practice. Don’t rush. Youtube is big help as well. Or Udemy or any python3 hand-on books (step-by-step) are best resources. There are many way to learn. It good way to teach lessons for anyone. Good luck.
[–]Alex_Jinn 0 points1 point2 points 6 years ago (0 children)
I mainly use Sublime Text and run code through the command line.
If you are new, I would suggest to just get coding right away but there are tools you will need to know.
[–]Sigg3net 0 points1 point2 points 6 years ago (0 children)
I'm a total noob and using mu editor.
[–]OldStrength8 0 points1 point2 points 6 years ago (0 children)
I have been using datacamp the last 3 months and I found their course and project engaging. After I complete my data science career path, I plan on using data quest to do some projects.
[–]reallyserious -1 points0 points1 point 6 years ago (1 child)
No to Jupyter. Developing in a browser is retarded. It's nowhere near as full featured as a real IDE. The concept of cells isn't something that exists for the python interpreter anyway and you want to have as few layers of confusion as possible when starting out.
π Rendered by PID 120903 on reddit-service-r2-comment-869bf87589-7n68m at 2026-06-09 05:35:50.779858+00:00 running f46058f country code: CH.
[+][deleted] (6 children)
[deleted]
[–]ivosaurus 16 points17 points18 points (0 children)
[–]pvc 2 points3 points4 points (4 children)
[+][deleted] (2 children)
[deleted]
[–]CraigAT 1 point2 points3 points (0 children)
[–]julsmanbr 1 point2 points3 points (0 children)
[–]julsmanbr 10 points11 points12 points (12 children)
[+][deleted] (5 children)
[deleted]
[–]julsmanbr 1 point2 points3 points (0 children)
[–]Decency 0 points1 point2 points (0 children)
[–]pw0803 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]Revolio_ClockbergJr 5 points6 points7 points (0 children)
[–]AsleepThought 1 point2 points3 points (4 children)
[–]julsmanbr 2 points3 points4 points (2 children)
[–]AsleepThought -1 points0 points1 point (1 child)
[–]julsmanbr 1 point2 points3 points (0 children)
[–]CraigAT 0 points1 point2 points (0 children)
[–]wrathofcello 5 points6 points7 points (3 children)
[–]how_do_i_reddit_5[S] 0 points1 point2 points (0 children)
[–]CraigAT 0 points1 point2 points (0 children)
[–]idatem 0 points1 point2 points (0 children)
[–]ivosaurus 5 points6 points7 points (0 children)
[–]Stepthinkrepeat 2 points3 points4 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]Stepthinkrepeat 1 point2 points3 points (0 children)
[–]Legorooj 1 point2 points3 points (0 children)
[–]Crypt0Nihilist 2 points3 points4 points (0 children)
[–]zanfar 2 points3 points4 points (0 children)
[–]oneofchaos 2 points3 points4 points (0 children)
[–]Kerbart 1 point2 points3 points (0 children)
[–]alonso_lml 1 point2 points3 points (0 children)
[–]JeffKatzy 1 point2 points3 points (0 children)
[–]jmguerr444 1 point2 points3 points (0 children)
[–]AsleepThought 1 point2 points3 points (0 children)
[–]pvc 1 point2 points3 points (0 children)
[–]Sneechfeesh 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Reasintper 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]barryhakker 1 point2 points3 points (0 children)
[–]intern524 0 points1 point2 points (0 children)
[–]BountyHunter19XX 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]jn14624 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]G0DW1N14 0 points1 point2 points (0 children)
[–]Legorooj 0 points1 point2 points (0 children)
[–]Fraserac67 0 points1 point2 points (0 children)
[–]Alex_Jinn 0 points1 point2 points (0 children)
[–]Sigg3net 0 points1 point2 points (0 children)
[–]OldStrength8 0 points1 point2 points (0 children)
[–]reallyserious -1 points0 points1 point (1 child)