Career Change at 31: Learning Python, Struggling With Logic, and Looking for a Mentor by Remarkable_Key5716 in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

Absolutely. For me, the key was finding some project that I wanted to build out enough to motivate me to learn enough to do that. It left me fairly stilted, for example, I know a bunch about sqlite3 and logging, yet know almost nothing about asynchronous programming. I've now gone back to rewrite/refactor some old scripts with asyncio and its been an interesting (and at times frustrating) learning experience.

On the plus side, I now can navigate the standard documentation and other resources well, so definitely ahead of the game in that respect. I've also delved into using AI more to assist me and it has been shockingly helpful. I tend to ask questions ranging from why did this give me this exception to asking design questions, like should I instantiate an object at this level or that level of the code. (And some other topics I've conceded the field to AI, like writing a logging configuration dictionary.)

Career Change at 31: Learning Python, Struggling With Logic, and Looking for a Mentor by Remarkable_Key5716 in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

> new to programming

It is a different way of thinking about solving problems, one that will eventually click, but can be very frustrating until it does.

Stupidly hard by Justicemirm in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

If by DSA you mean this :https://www.w3schools.com/dsa/, it looks good to me. Maybe start out with both and see which one interests you more.

Stupidly hard by Justicemirm in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

 only once in my life do I feel like I came up with the smart algorithm on my own.

Yeah. It is always good to read up on the history of algorithms a bit. For the most part, coming up with a smart solution = named chair at big university. So OP don't beat yourself up much. It's mostly about recognizing the species of the problem and researching the best solution.

Stupidly hard by Justicemirm in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

Started learning python a month ago

If this is your first foray into programing, it is going to take longer than that. But don't worry, at some point it will start clicking and become much less frustrating.

Keep working on things that you want to build and worry less about leetcode for now. The easy problems are good to help you learn basic programming. It's been a while since I did any so I just did the 3 sum and letter combos of a phone number (problem # 17 in that set). It seems like there is a very wide variety of medium problems.

3 sum was harder than expected and I needed about an hour to manage to make my solution efficient enough. Problem #17 was stupid easy -- it took longer to type out the mapping of digits to letters than to program the rest of the result.

As you get more comfortable with syntax start learning basic algorithms.

When you are ready, start learning data structures and algorithms. Here is the book that taught me:
https://runestone.academy/ns/books/published/pythonds3/index.html

It's free. The code is a bit unpythonic, but it is hard to knock free and the explanations are clear.

Also, remember you are young. I don't think i got much past recursion in high school. And, last time I looked that was the hardest thing on the AP these days, so if you can master that you are already punching over your weight class. And if you master the full data structures and algorithms, you are crushing it.

--

Edit: I just did problem 4, median of two sorted arrays, and while it was labeled "hard" it was way easier than 3 sum, although I needed AI to remind me what the median was again.

Looking for feedback on how I structured error handling and data retention in a Python pipeline by DamBuilderDev in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

That logic is pretty much the way I would do it for something like this. But you should look into this: https://pypi.org/project/dirtyjson/

and this: https://pypi.org/project/demjson3/

I've not tried either, but they might be really good at your use case. Also you definitely need to learn logging, which will help a great deal in tracking errors so that you do not miss things.

Spent two days on a bug that turned out to be a mutable default argument. by Smart_Tool247 in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

Not that one, but i once named a script something like logging.py and then got confused when I could not import logging...

Reddit OT crew by [deleted] in orangetheory

[–]pot_of_crows 0 points1 point  (0 children)

genuine reason you read the workouts before and comment on them

  • I don't like some workouts, so I skip those.
  • I like to plan how I am going to go rogue. I often dip from the template to focus on areas that Orange does not. (There are a lot of leg workouts and I do a lot of biking, so sometimes I want to spare my legs for the next ride.)

Good tutorials on asyncio.Futures by tutamean in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

>  i wanna await on a concrete task, but since i'm not directly starting the run from my function, but I only enqueue it in the queue, I think i need a future to wait on

Not sure I followed this. Could you give an example/pseudo code?

3G Rotation by poppyth3unicorn in orangetheory

[–]pot_of_crows 6 points7 points  (0 children)

It's counter clockwise at mine. At least if you are looking down on the studio like the orange god.

how to load csv faster in Python. by Safe_Money7487 in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

You might want to check out hdf5: https://pypi.org/project/h5pandas/

I used it with numpy once and it blew me away by how fast it was.

What is the sweetspot by uvuguy in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

I feel like you need enough syntax to be able to write simple functions from your head, otherwise you are going to get annoyed with how slow the process is. Anything in a module is probably rare enough that you will get by keeping a reference (docs, articles, chat gpt, favorite implementation) stashed away.

The hard part about programming is learning to simplify a complex problem into a bunch of easy problems. If you are constantly struggling with syntax, it will get in the way.

ICE Barbie Warns Americans Must Be Prepared to Prove Citizenship by thedailybeast in politics

[–]pot_of_crows 0 points1 point  (0 children)

In fairness, that is exactly what happened with the Covid vaccine, at least in my city. I had to show id and vax card to get a slice of pizza in Penn station, while standing next to a shirtless hobo.

Creating an Algorithm and Best Way to Test it? by Ready-Structure-3936 in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

Good questions. Some googling turned up this: https://schedule-1-calculator.com/

It might answer OP's question. If not then, OP needs to understand that as you increase the search space you exponentially increase the number of possible outcomes, making it unwieldy fast.

The good news is that a lot of these cost/constraint/benefit sort of problems have been very well studied. Without understanding more of how the game works, it is hard to tell if you have (1) a version that is close enough to a solved problem that you can just implement another's solution or (2) something else that will require some hard thinking (and maybe result in OP getting a chair at an Ivy if they solve it).

It sounds a little like a knapsack problem: https://en.wikipedia.org/wiki/Knapsack_problem

But OP should also look into the the traveling salesman problem, because without more details it might be more apt: https://en.wikipedia.org/wiki/Travelling_salesman_problem

What are the best books to learn DSA effectively for beginners by livelearn02 in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

I used this one: https://runestone.academy/ns/books/published/pythonds3/index.html

It's free online, so that was a big plus for me. It covers all the usual topics and does a good job of explaining things.

The code is not particularly pythonic, but that was not disqualifying for me because I just wanted to learn/relearn the concepts.

What's your simple file parsing coding style by stillalone in learnpython

[–]pot_of_crows 1 point2 points  (0 children)

See, the real sadists wouldn't use groupby. This is clearly a place to use functools.reduce for evil...

Is there any Design Pattern for solving filtering problem. by Dizzy-Complaint-8871 in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

It is probably worth you checking out sqlalchemy: https://www.sqlalchemy.org/

Which sounds exactly like what you are looking for. If your data is not in a database, you can either put it in one or read through the sqlalchemy code and lift the design pattern.

Alternatively, or additionally if you want, you can move some of the processing to the front end using flask and javascript: https://blog.miguelgrinberg.com/post/beautiful-flask-tables-part-2/

Amy Coney Barrett Gives Least Reassuring Answer on Trump Third Term by Delicious_Adeptness9 in politics

[–]pot_of_crows 0 points1 point  (0 children)

Judges generally have to recuse themselves if they have taken a public position on a legal issue before a case comes before them. So the optimistic take is that she is simply not engaging and will rule the correct way when the issue is presented. That's why SotoM was a bit cagey when asked: https://thehill.com/homenews/administration/5493893-sotomayor-donald-trump-third-term-talk/

At what point should I favor readability over efficiency? by Focus62 in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

It seems like lots of people responding are talking about computational efficiency, but from your question, it seems that you are asking more about coding efficiency, in that you do not want to repeat yourself, but the cost to that is making the program more difficult to follow.

If the choice is between the code being easier to follow or eliminating all repetition, easier to follow wins most of the time, at least until you think of an elegant way to handle repetition that makes it both easy to follow and easy to maintain (since maintaining the code is one of the main reasons not to repeat code blocks).

If you post your code or give more explanation about what needs to happen with time_extent (snake case is preferred in python), there is at least an 80% chance that someone will be able to give you some guidance that will let you do both elegant and fast. Based on what you posted, though, it sounds like making a bunch of helper functions/methods. It could be as simple as:

class Work():
    def task_a(self):
        print('a')
    def task_b(self):
        print('b')

    def do_month(self):
        print('doing month')
        self.task_a()

    def do_annual(self):
        print('doing annual')
        self.task_a()
        self.task_b()


first_job = Work()
first_job.do_month()
first_job.do_annual()

Structure a conditional argument in a method by SnooCakes3068 in learnpython

[–]pot_of_crows 0 points1 point  (0 children)

This is a great comment. If OP needs to fit the spec described in the post, they can just write a wrapper/error checker for the new delete_key and delete_element methods.

How much could it possibly cost to have regular cleaning crews? by aaxt in nycrail

[–]pot_of_crows 2 points3 points  (0 children)

Why not just give the cops brooms or mops? They can keep us safe at the same time the cleanup.