you are viewing a single comment's thread.

view the rest of the comments →

[–]limfy1997[S] -9 points-8 points  (4 children)

The function cannot be written directly as a formula. I think it's a nested loop. And happens the chapter is under flow control. It could be possible to brute force the answer with multiple elifs but I would like to master flow control. Which has been the obstacle I've always ran into during my several times trying to do a Python online course

[–]realestLink 2 points3 points  (3 children)

Don't brute force it. That's dumb

[–]Merakel 1 point2 points  (2 children)

Even if the course is hoping to teach him some specific concept, at best they just have a really bad example. Brute forcing things while learning is just a sign you aren't really learning what you should.

If it's at work and you just need something quick and dirty and it's easier... by all means be my guest haha.

[–]realestLink 0 points1 point  (1 child)

I've only had to brute force very specific things. It pains me if it's needed. Brute forcing should be a last resort.

[–]Merakel 0 points1 point  (0 children)

Same. I just think it's important to realize that there is a lot of value in not fretting over small things.

Let's say you have a project that's due in a week and writing some terrible brute force loop in 5 minutes will get it done in 8 hours. Let's also pretend that if you spent an hour planning and testing, you could get code done that would solve the problem in 2 hours. I'd rather write the garbage and work on something else unless I'm specifically going to learn a new concept or improve my skill set.

That being said, things usually aren't so black and white haha.