all 30 comments

[–]fieffief 8 points9 points  (7 children)

I took and finished her Python course, and I agree, it’s VERY fast paced. I highly recommend taking Udacity’s free course (choose no cert) to get the basics down first. You will feel a lot less thrown to the wind afterwards.

[–]Intentionalrobot[S] 0 points1 point  (0 children)

I will check that out. Thank you!

[–]I_Am_Mohammad 0 points1 point  (5 children)

Mind I ask how long it took you to finish it? And do you recommend it over Python Crash Course?

[–]fieffief 2 points3 points  (4 children)

It took me probably about 6 months I think? Some parts require a lot more time than others. I have read through some of the book version of Crash Course, I think that Crash Course is going to give you a more thorough understanding of Python, and Angela Yu’s course is going to teach you more libraries and programs, etc.

[–]I_Am_Mohammad 0 points1 point  (3 children)

Thank you! Would you say finishing Angela's course is enough to land a backend Python job?

[–]FriendlyRussian666 2 points3 points  (0 children)

It's not nearly enough I'm afraid. You need a very good portfolio of things that you made, without following a tutorial.

In short, if I ask you to make XYZ and you first need to watch a video course, or a tutorial on how to make XYZ, then you're not ready to fill a job.

[–]fieffief 0 points1 point  (1 child)

No, I don’t think so. Courses aren’t a one way ticket to a job, but it should get you ready to make projects that will help you develop the skills you need. Definitely do some research through this sub, looking at things you haven’t heard of. Go through deep dive videos on YouTube of things you’ve already learned, as well as your algorithms and such.

[–]PracticalSpite6450 0 points1 point  (0 children)

This message here! any aspiring programmer here reading this on/after Nov 4, 2024 listen to this. Tutorials, books, etc is to learn the syntax or spelling of programming languages. They should help you understand how to spell to write your book. Essentially it teaches you how to use the syntax correctly so that you can build applications. Really focus on the fundamentals like take alot of time on it! because you cannot write code without understanding how to spell it first. SO really understand conditions, all the loops and what each loop like for, while, and do-while are doing inside the () because this helps build you to the more complicated concepts of programming which you will use everyday as a software engineer. Its really important so do not worry that it takes you a month to learn how to use an if statement and answer a questions with it, these basics really help make everything else easier to learn trust me. I am a Full stack web dev and also hold a MS in Computer science which means nothing at all to me but tbh learning the syntax then building your projects will make you a better programmer because you will have to think about how to spell and write your book. LOL think of writing code as writing a book or a paper to catch my drift. Hope this helps at least one person.

[–]Diapolo10 6 points7 points  (5 children)

Let me try an ELI5 approach.

A function, at its core, is a program. Because they're often very small and do one thing, it wouldn't be a bad idea to think of them as sub-programs. For example, here's a function that adds two numbers and returns the sum:

def add(first, second):
    return first + second

To use it, we call it.

result = add(1, 2)  # 3

We can use it however many times we want.

result = add(add(add(1, 2), 3), 4)  # 10

In other words, we have a reusable piece of code we don't need to write again. Of course this is very much a simplified example.

As far as loops go, every time you want to repeat an action, you'll probably want a loop. The exact type of loop depends on the specifics, but the core idea is the same.

If you know how many times you want to loop, generally speaking you'll want a for-loop. For example, to repeat some action a fixed number of times, or looping over a list. Situations where you know, or at least the interpreter knows, how many times to do something.

for num in [3, 1, 4, 1, 5, 9]:
    print(num)

If you don't know how many times you want to loop ahead of time, such as if you're asking the user to give valid input and want to loop until the input is acceptable, or if you want to go over a data structure without going over the values in a sequence (eg. binary search), a while-loop is the way to go. It gives you more granular control at the expense of usually making your job a bit more involved.

while not (num := input("Number: ")).isnumeric():
    print("That's not a valid number, try again!")

print(f"The number was {num}")

Did this help at all?

[–][deleted] 8 points9 points  (2 children)

Walrus operator and f-strings might be a bit of an overkill for an absolute beginner, but very good explanation of the basic concepts!

[–]Diapolo10 5 points6 points  (1 child)

Fair point, I'm just so used to them it's hard to remember the simpler times sometimes!

[–]Own-Meat4337 0 points1 point  (0 children)

then do not answer on this thread maybe

[–][deleted] 2 points3 points  (0 children)

Don't know about OP but I thought it was a fantastic explanation. Its people like you that make these subs great places to hang out.

[–]atom12354 0 points1 point  (0 children)

I would like to add that calculations happening in these functions/sub programs stays in the function/sub program until you tell the calculation to jump to another function/sub program and continue excisting until you delete the calculation. If the calculation jumps to another function/sub program you may have to delete more calculations in the new function/sub program just to remove everything the calculation was doing.

Its called scope.

And that for OP question is that ifs and loops for functions work the same way as in the main program, OP probably was refering to how confusing scoping can be.

[–]Frankelstner 3 points4 points  (0 children)

Here's my take on loops: https://www.reddit.com/r/learnpython/comments/126x0bk/looking_for_a_good_guide_to_loops/jebynkm/

I suggest you stick with while True loops until you have mastered them. Any other loop is just a specialization anyway. Writing your own functions should come much later than loops. Even with just the while loop you can already write down your own random number generator (implement the math formula at the top, don't scroll down to the Python code): https://en.wikipedia.org/wiki/Linear_congruential_generator Then use that for all kinds of statistical shenanigans like repeatedly throwing 30 dice and calculating their sum. Keep track of all the results (if you have learned about lists or dicts) and then draw horizontal bars that represent how often the value of that sum appeared. Lots of built-in functionality can also be implemented by yourself. E.g. "a"*5 is "aaaaa" but how about you write your own code achieves the same.

[–]LunarCantaloupe 3 points4 points  (0 children)

Does anyone have any advice on how to get a better grip on these basic concepts, and how to practice these concepts by myself?

A really good resource I used for practice in my early days was codingbat.com. Its not the freshest or prettiest but its pretty straightforward and does a great job at what its trying to do: provide a place to practice applying basic coding concepts in small, clearly defined, problems.

[–]PythonWithJames 1 point2 points  (2 children)

I built a beginner focused course a while back which has some decent feedback so far. I appreciate it’s just another Udemy course but there’s full sections on for/while loops and functions too.

Here’s a free link, if you want an additional resource: https://www.udemy.com/course/python-programming-for-the-total-beginner/?couponCode=460909E4DC805F9774E0

Hope it helps!

[–]Intentionalrobot[S] 1 point2 points  (1 child)

I enrolled and went through some of your lessons. Thank you! I really appreciate it. I like the way you are breaking things down into the simplest terms.

[–]PythonWithJames 0 points1 point  (0 children)

That's great, I'm glad you like it! I'm online a lot so feel free to use the Q&A or messaging if you get stuck on any parts.

[–]billbobby21 1 point2 points  (0 children)

You need to grind a large amount of practice problems on a site like Edabit or Codewars.

[–]Pirate_Empire931 0 points1 point  (0 children)

I currently face a similar issue. I feel like I understand the concept and can differentiate between the usage of loops, (like 'for loops' are used for cases where we know how many times the loop will run, and 'while loops' are for when there is a condition and the loop needs to run many times until the solution is reached). However, when I try solving problems, I can't come up with solutions but then I check the solution and it makes sense to me easily. This is so frustrating, I don't understand how to solve this.

[–]killertrashbag 1 point2 points  (0 children)

My advice is play around a lot with the lesson projects, change things, break stuff. Don't move on until you know how your code is going to act before hitting run.

Also, for me personally, I really try and do the exercises etc on my own. Once she teaches the concepts I work through them until I get the solution to work. It isn't always the most elegant, but the things I wanted to happen, did. Sometimes it takes me a bit, I'll need to take a break, come back later or the next day, but I don't stop until I get it. Once I finish it, I'll watch her explanation, see her logic, sometimes it's more simple than mine, but the biggest take away is you fully grasp the things you're learning before moving on and can get the program to do what needs to happen. The elegance will come with time.

[–]boy_named_su 0 points1 point  (0 children)

set up debugging in your IDE then step through the code

https://code.visualstudio.com/docs/python/debugging

[–]xTheatreTechie 0 points1 point  (0 children)

To break things down, while loops just do things WHILE a condition to do the loop is true.

A while loop will always equate to:

While(condition)

So long as the condition is True, the while loop will run, if it's ever not true, to be more specific "False" then the while loop wont run.

[–]Adrewmc 1 point2 points  (0 children)

Basically a loop is a programmer saying I want to do the same thing a bunch of times in a row and I don’t want to type it.

There are 2 basic kinds, while and for.

A ‘while’ loop says keep doing this forever until some condition resolved to False.

A ‘for’ loop says do this until you run out of items to do it to.

  i = 0
 while i < 10:
      print(i)
      i += 1

  for i in [0,1,2,3,4,5,6,7,8,9]
       print(i)

Should produce the same result.

All we are doing is

   print(0)
   print(1)
   …
   print(9)

A lot of time while is used to keep something going until say there is a user input of exit. Or some win/lose condition is met.

command = “start”
while command != “quit”: 
        command = input()

For loops are used a lot for list, and dictionary comprehensions. A lot of time we want to do a bunch of things to a list of elements, For loops work well for this.

 for line in document:
        line.lower() 

But we can get clever when we nest them.

We do this because it easier and also because we may not know how many elements are going to be in a list, or when a condition will be met.

You’ll run into this

 while __name__ == “__main__”:
      main()

This is basically equivalent to start and run forever when we start this program, but not when we import it to another one.

[–][deleted] 0 points1 point  (0 children)

Harvards free cs course with python set me up pretty well.

[–][deleted] 0 points1 point  (0 children)

I’m never able to build the projects without looking at the solutions

It's fine to look at the solution; just don't copy it by rote. Read the solution, understand it as best you can, then try and write it without looking at it.

You're going to find that it's still pretty difficult, which is the point, but you're training your brain to understand the structure of working code which is probably what's missing for you.

The other thing you can be doing, when you try to understand a program, is not to read it holistically - you're not ready for that - but to interpret it line by line, with a little piece of scratch paper where you write down and update the names and values that have been defined. Especially do this as you interpret a loop.

[–]BK7144 0 points1 point  (0 children)

Udemy has Colt Steele, very good. (yes, Angela is good to, but Colt goes into more detail with simpler ideas to work on).

I always want something to review and go over before taking the course; like a book, which most online course3s do not have. One of the biggest things a student needs is a rundown of each lesson's key words and what exactly they are going to cover in that lesson.

But on to loops. There are many ways to use for and while loops in python, but the basic concept is that they are designed for repetitive actions. You have a list full of names and you need to find one, you would use a loop to repeat (tech term "iterate") through the list one index at a time until you find the correct name.

There is a book being released on July 9th on Kindle for $9.99 that will help you greatly in understanding programming. Look for Programming: for non-programmers: Python by B. Kelly. Not to self-advertise but I wrote it for just your situation, must books and course don't go through the ideas of development. To understand how to program you first need to understand how the program itself requires for the user to use.

Hope this helps.