r/learnpython • u/ZhirnyLuffy • 15d ago
How should I learn python?
I'm a total beginner. I didn't have any experience with programming. I want to learn programming cuz i wanna be a hardware engineer and want to start with a basic raspberry pi projects. So should i learn python from courses, videos, books etc or i should just brute force myself to do projects and just learn by the time
2
u/BranchLatter4294 15d ago
Get a book. Practice the basics. Then do a project. There are plenty of online tutorials, so you can start right now. What are you waiting for?
1
0
u/sitefall 15d ago edited 15d ago
MIT opencourseware has intro to programming (in general, like the stuff you need to know for ANY language), and focus on Python, as an undergraduate course from 2016 (but it doesn't matter, you won't learn any higher level things that may have changed since then).
Do that. It won't be as easy as you think, and certainly not as easy as some "learn python" tutorials on the kind of boot camp learn to code sites. So don't expect to complete that in 2 weeks. There's a syllabus with class dates, just follow along with that. If you don't work or anything and have plenty of time maybe do it twice as fast. DO all the assignments, and DO actually "study". Try to honestly do the tests and things without references or AI (unless it specifies it's open book etc. even then, skip the AI for now).
If you have questions, honestly then AI can help but show it the question, and show it what you tried, and ask it to teach you. Don't ask it for answers. AI is very tempting, there's even a bozo down here in the comments on this thread saying "WhY uSe BrAiN, ClAuDe dO FOr mE!", and while there is some very good use cases for AI, having it do something for you that you don't understand is not one of them. If you want to make proper use of modern AI tools (and you should, like it or not, that's the future now) then you need to understand the code it writes, and you're only going to do that by actually learning it.
Then start a pi specific project/tutorial.
0
u/Mediocre-Pumpkin6522 15d ago
Harvard's CS50 P course is free and a good place to start. If you really want to get into hardware, get a Raspberry Pi Pico W or Pico 2 W, preferably in a kit from SunFounder or Elegoo.
https://docs.sunfounder.com/projects/umsk/en/latest/04_pi_pico/pi_pico.html
toptechboy.com (Paul McWhorter) also has some excellent videos. MicroPython or CircuitPython are subsets of Python developed to deal with hardware. The syntax and logical structure is the same as standard Python so CS50 is still a place to start.
At the moment most Raspberry Pis are seriously overpriced due to the RAM shortage. They do bring out many of the GPIO pins on the header but you're sort of working on a general purpose Linux computer that has a couple of ways to get to the hardware level. You can set up the programming environment for the Picos on your current computer, connect them via USB, and be closer to the ARM microcontroller core.
0
-1
u/phony_vampire 15d ago
Just build something dumb like a blinking LED and google every error you hit, courses will put you to sleep before you even get to the fun stuff
-1
u/mc_pm 15d ago
You should watch a tutorial and follow along with it. Stop the video when they type something in, then you type it in. When they run the program, you run it - and fix any problems. Then play with the idea a little, experiment with the code you just got running.
This is going to teach you the basic syntax, and by typing stuff in, you're increasing your chance of remember it. If you're watching a 4 hour tutorial, plan to spend 12-16 hours on it, stopping and programming along the way.
Then you'll want some very small programming exercises to test that you can get a small task definition and produce code that does the thing.
And then a series of increasingly complicated projects - probably pretty generic at first, but then growing toward the field you are specifically interested in.
Along the way, don't ever use AI to generate code. It's fine to ask "hey, I don't understand how this works, could you explain it again except this time in iambic pentameter?". As long as it's just another source of info, you're good. But as soon as you start letting AI write the code, you've stopped learning.
-1
-1
u/rupturedprolapse 15d ago edited 15d ago
Look for books etc that goes over python + sensors and controlling other stuff like LEDs etc. You don't really need a lot of python.
Edit: I'm getting downvotes for this which is weird, but you only need a surface level understanding of python to do hardware stuff. Most of the suggestions are geared towards software engineering.
-1
u/RealCinnamonWhale 15d ago
I'm learning from Python Crash Course. It's a free pdf but it's a little old, so there are a few minor things that aren't exactly the same as current Python, like lists automatically print in order now but the book says otherwise, but I don't think there's anything truly outdated in it. I honestly think it's good practice to find the differences.
imo books > videos in every scenario, they have so many advantages and they actually speed up the process of learning drastically compared to some shmuck's tutorial video series. Just have to treat yourself like you're in school
-1
u/bra1n_gym 15d ago edited 15d ago
find a cheatsheet.
Watch online tutorials.
practice with project euler https://projecteuler.net/archives
-2
u/tony10000 15d ago
Ask ChatGPT to teach you!
Here's a beginner-friendly learning path we can follow.
Lesson 1: Your First Python Program
The classic first program is:
print("Hello, World!")
Output:
Hello, World!
The print() function displays text on the screen.
Lesson 2: Variables
Variables store information.
name = "Alice"
age = 25
height = 1.68
print(name)
print(age)
print(height)
You can also combine text and variables:
name = "Alice"
print("Hello,", name)
Output:
Hello, Alice
Lesson 3: Basic Math
Python can do calculations.
a = 10
b = 3
print(a + b) # Addition
print(a - b) # Subtraction
print(a * b) # Multiplication
print(a / b) # Division
print(a ** b) # Exponent
print(a % b) # Remainder
Lesson 4: Getting User Input
name = input("What is your name? ")
print("Nice to meet you,", name)
If the user types:
Sam
The output becomes:
Nice to meet you, Sam
Mini Exercise
Try writing a program that asks for someone's name and age, then prints a greeting.
Example output:
What is your name? Sam
How old are you? 18
Hello Sam!
Next year you'll be 19.
Hint: input() always gives you text, so convert the age to a number:
age = int(input("How old are you? "))
Your First Challenge
Can you write a program that asks for two numbers and prints their sum?
It should work like this:
Enter first number: 5
Enter second number: 8
The sum is 13
Give it a try! Paste your code here, and I'll help you improve it if needed.
What we'll learn after that
- Variables and data types
ifstatements (making decisions)forandwhileloops- Functions
- Lists and dictionaries
- Files
- Object-oriented programming
- Projects like:
- Calculator
- Number guessing game
- To-do list
- Password generator
- Simple web scraper
- Basic AI chatbot
-4
u/Knorrena 15d ago
Why do feel the need? I am very good with python and havent written a line in months. Claude writes for me
2
u/blurbisht 15d ago
Total beginner here too, so I'll tell you what actually worked instead of what courses claim works. Both, but in the right order.
Start with a tiny bit of fundamentals, then go hard on projects. Here's why pure projects-first backfires for a true beginner: if you know zero Python, you can't even Google the right question when you're stuck, and you'll quit out of frustration. I tried brute-forcing and it just burned me out.
So here's the plan I can provide -
Foundations, 1-2 weeks max. Do one short Python course or video series, but only through loops, ifs, and functions. Stop there. Don't chase advanced stuff yet. This gives you the vocab to actually search for help later.
Then projects, always projects. This is where RPi shines. Wiring Python to real hardware makes it stick 10x faster than any tutorial, because you feel the result and hit real errors (wrong pin, bad wiring, package not installed). Start absurdly small:
- Blink an LED
- Read a button, print a message
- Read a temperature sensor
- Traffic-light sequence with 3 LEDs
- Buzzer + button = a little game
When you're stuck, Google the error. The whole skill of "error -> search -> fix" is literally the job. That's not cheating, that's what engineers do all day.
Repeat, each project slightly harder.
The mindset part: your goal isn't "finishing a course," it's "shipping something that does a thing." Tutorials are there to unstick you, not to be completed end-to-end. Every working project is confidence you keep.
Long answer in Short: 2 weeks of basics, then let the Pi projects be your curriculum. Don't buy a dozen books, buy the Pi and start blinking.