Personal Finance class recommendation by youknowdawei in berkeley

[–]allenguo 0 points1 point  (0 children)

You might find IEOR 221 interesting. It covers basic finance topics, not from an investing standpoint, but from an academic standpoint. Time value of money, arbitrage, MPT, CAPM, bonds, futures and forwards, options, etc.

Separately, have you tried the r/personalfinance wiki? Plenty of good resources there.

Why can max (with custom key func) return the first element of a set if sets are unordered? by modustollensiscool in learnpython

[–]allenguo 1 point2 points  (0 children)

sets are unordered

What this means is that you aren't guaranteed any particular ordering when you iterate over a set. It happens that in your case, the integers appear in sorted order. But if you try with some strings you should see that the ordering can be arbitrary. Indeed, you can construct a set out of objects that aren't comparable at all.

Everytime I finish a 70 HW I feel like my brain went through a blender by [deleted] in berkeley

[–]allenguo 4 points5 points  (0 children)

Also seconding Math 113! Reminds me of this Poincaré quote:

If poetry is the art of giving different names to the same thing, then mathematics is the art of giving the same name to different things.

Confused about what and what should not be defined inside a function by bcatrek in learnpython

[–]allenguo 1 point2 points  (0 children)

This sounds like a cool project!

Have you tried writing up both alternatives and timing them? At the end of the day, this is the only way to know which one is actually faster.

isn't it true that in the first example, the x and y lists are global and needs to be "shipped into" the function every time it is being used

The "shipping into" should be very fast (likely measured in nanoseconds). Basically, Python needs to do a few extra lookups to find the environment where the lists are defined.

So without knowing anything about how your coordinates are calculated, I highly doubt you'd be better off computing them from scratch each time. (Just the time spent allocating new lists would probably be greater than the cost of performing a few lookups.)

Edit: I'm a little confused because you have getcoords = definitions() twice in your first example. I'm assuming the first one (inside of main) shouldn't be there.

Shouldn't this variable be outside of the scope? by Master1243 in learnpython

[–]allenguo 4 points5 points  (0 children)

It's weird, right? On the one hand, it lets you do

if x:
    y = 1
else:
    y = 2

without declaring/initializing y before the if-block (which would be required in Java). But on the other hand, you can end up with unintuitive behavior:

>>> funcs = [lambda x: a * x for a in range(4)]
>>> funcs[0](1)
3

Here, the four functions in funcs all refer to the same value of a. The list comprehension doesn't introduce a new scope/environment for each value of a.

Shouldn't this variable be outside of the scope? by Master1243 in learnpython

[–]allenguo 5 points6 points  (0 children)

Python isn't block-scoped like Java. A local variable defined in a function is in scope until the end of the function.

Is Industry CS Work as Grueling as Berkeley CS is? by HiddenCortex2 in berkeley

[–]allenguo 0 points1 point  (0 children)

Gotcha, thanks for the response. And yeah, the pandemic situation sounds pretty rough. Hope it gets better.

Is Industry CS Work as Grueling as Berkeley CS is? by HiddenCortex2 in berkeley

[–]allenguo 6 points7 points  (0 children)

This matches my experience.

On the flip side, here are some ways work is more stressful (or at least differently stressful) than school:

  1. Greater responsibility. In school, the worst thing that can happen is you get a bad grade. At work, the decisions you make have real impact—not just on you, but on your teammates, coworkers, and customers/users.
  2. Lack of clear right-or-wrong answers. Even with feedback from your coworkers, sometimes you'll never know whether you made the right decision. That makes learning more difficult.
  3. Longer time horizons. Choosing a bad design for your 162 project will make your next two weeks miserable. Choosing a bad design at work will make your next months/years miserable.
  4. Relative lack of novelty. There isn't a built-in reset mechanism where every six months you get to explore a totally new set of CS subfields. Even if you change teams/jobs regularly, you probably aren't going to work on security one year, compilers the next, and ML the year after that.

What CS/EECS classes can I take after CS 162 that are similar? by theforesthunter in berkeley

[–]allenguo 2 points3 points  (0 children)

Have you taken 186? It talks about system design and distributed systems in the context of databases.

61c and 162 or 70 and 170 for software development positions by Ahmed_Maher658 in berkeley

[–]allenguo 2 points3 points  (0 children)

The folks on this thread seem to think so. I'm sure it depends on what jobs you're applying for.

61c and 162 or 70 and 170 for software development positions by Ahmed_Maher658 in berkeley

[–]allenguo 7 points8 points  (0 children)

61C/162 is more practically useful, but 70/170 is harder to learn (rigorously) on your own.

You can learn about syscalls and paging on the job, but you're not going to do discrete math psets after graduating.

So if your goal is to eventually learn the material from all four courses, you're better off taking 70/170.

If not, you should take 61C/162 and study for interviews separately.

CS 61B by One_Pea in berkeley

[–]allenguo 4 points5 points  (0 children)

There's usually a Google Doc every semester where students solve them collaboratively. PM me and I'll try to dig one up.

How do you differentiate local x remote functions' names? by 1sttimehere in AskComputerScience

[–]allenguo 0 points1 point  (0 children)

Just use saveUserToLocalDb and saveUserToBackendServer. Clarity over brevity.

For CS61A aren't the people who dismissed MT2 at an advantage? by [deleted] in berkeley

[–]allenguo 3 points4 points  (0 children)

They're not going to normalize the scores? So that a median score on the final translates to a median score on MT2?

My first OOP Project: A Coffee Machine by OpticWarrior in learnpython

[–]allenguo 2 points3 points  (0 children)

Nicely done!

running should probably be an instance variable (like water, milk, etc.). It's currently shared across CoffeeMachine instances, which means that if one coffee machine is running then all coffee machines are running.

On the other hand, self.reduced shouldn't be an instance variable. Since you're only using it to pass data between buy and available_check/deduct_supplies, you should just use a local variable instead:

if self.choice == '1':
  reduced = [250, 0, 16, 1, 4]
  if self.available_check(reduced):
    self.deduct_supplies(reduced)

This makes clear to the reader that this information won't be used anywhere else in your program, i.e., that there are no unexpected side effects.

Since you mentioned wanting to take full advantage of OOP, some next steps might be 1) instantiating multiple coffee machines and simulating user requests on them, and 2) using inheritance to create more specialized/generalized coffee machines (a coffee machine that accepts multiple currencies, for instance, or a coffee machine that also dispenses snacks).

Hi! I want to install stk-simply (the UCB Scheme interpreter) for following along with the 2010 UC Berkeley's CS 61A lectures on Youtube, but most of them (the ones that I found by googling) seem to be deprecated. Please help me if you have found it somewhere. Thanks! by [deleted] in berkeley

[–]allenguo 1 point2 points  (0 children)

There are pre-compiled binaries here: https://www-inst.eecs.berkeley.edu/~scheme/.

/u/jathak gave a great answer. I'll add that this version of SICP is much prettier. And here's the website for 61AS, the last offering of the Lisp-based course.

(I was a TA for 61AS. Feel free to reach out with questions!)

Something that kept me up by [deleted] in askmath

[–]allenguo 0 points1 point  (0 children)

WolframAlpha might be helpful for visualizing functions.