I'm trying to learn Python.

I learned HTML and CSS years ago, but have pretty forgotten them.

I want to understand code.

Any tips?

#asknostr

#grownostr

#plebchain

#code

#coding

#program

#programming

#Python

Reply to this note

Please Login to reply.

Discussion

If you have the time and don't want to rush things, learn C first but it will take time to get a grasp of it. It is like learning Latin and then learning one of the lanaguges based off it.

Thanks Len.

I started a C tutorial ages ago and never finished it.

My time is usually quite limited, but I'm currently on parental leave with a new baby so I have a little extra time for the next couple weeks.

I wouldn't have time to become fluent in it, but would it be worth going through a basics lesson?

Nah. A basic lesson won't do much. You need to dive in and use it for a while to get a grasp of it. So skip this step as it won't be beneficial in the long run.

Thanks for the honesty πŸ€™

Cheers and good luck on your journey!

Python is <3 If you have any questions I can help.

To learn though,a good way is to learn the basics like syntax first by reading beginner guides, then figure out something you want to do... like I dunno.. you want to make a program that tells you when to water your plants.

Then web search each piece you don't know how to do, eg how to make an object (class), how to put things into a list, etc...

Thanks so much.

Trying to think of a simple, yet practical project is half my hang up sometimes.

Followed πŸ€™

Here's another idea.. drawing on your electrician experience.

Make a program that reads a text file, which sort of mimics a panel schedule, but on each line instead of a load current, it has a voltage/resistance. With the goal being to find and add up the currents and spec a cable that can carry it all.

1) Find out how to open a file in python

2) Learn how to read it line by line

3) Process each line and find out how to pull the values and calculate the current, add to a list

4) At the end, add up all the values and figure out how to specify the right gauge wire

5) Print output

Holy smokes, thanks for the idea!

Take your time. Try to learn by writing code. After learning Python's syntax, you'll see that you might get stuck on the types of problems you'll be able to solve. With just the syntax, you might be able to write something like a sudoku solver (search for: backtracking), or maybe a calculator (search for: shunting yard algorithm). But to do anything useful, you might have to learn other things.

That's because real life problems need other types of knowledge, like understanding networking, things like sockets, IP, DNS, HTTP, etc. You might want to try to learn using Linux or BSD. If you want to learn web development, you might wanna learn HTML/CSS/Javascript/SQL.

Here is an essay that helped me a lot in my journey: https://www.norvig.com/21-days.html

Thank you! Your answer is really helpful.

I've learned a HTML, CSS, and JavaScript in the past, but never kept it up.

Maybe I'll revisit it eventually.

Followed πŸ€™

You don't need to learn everything at once. You better start with a small project like a command-line calculator and learn one by one. The most important thing is to continue using it, or you will forget easily.

πŸ™πŸ€™

Buy the book Programming Bitcoin and accomplish two things at once. It walks you through programming a Bitcoin library from scratch in python. I haven't finished it yet because I've been really busy but it's a great way to learn.

Wow, thanks for sharing that. I didn't know that existed!

I highly recommend Python Crash Course (volume 3!) by Eric Matthes from No Starch Press.

He does start with "Hello World", but quickly builds from there. Each chapter has practical exercises, and some of them build upon one another. He covers the basic components of the language (most of which are common in nearly all C-based languages), and shows how to use them together.

Aside from learning Python, he covers some "best practices", and demonstrates why they were created. This includes proper formatting, commenting, variable/function/class name usage, etc. He dabbles in Object Oriented Programming as well. Finally, and something I find to be really important, he shows how to write tests for your code. I used to be a Software Quality Assurance Engineer though, so I am biased.

The second half of the book is a walk-through to writing three complete programs; an arcade game, a data visualizer, and a web based site that manages users and their data.

I love the practical examples, how he's teaching more than just syntax, and the manner in which some situations are presented. After this book, it will be easy to learn more intermediate topics while still being able to write practical code for yourself.

https://nostarch.com/python-crash-course-3rd-edition

Thank you very much for this.

You all have been so helpful!

Followed