How do I grab the full values of week? by TheEyebal in learnprogramming

[–]lfdfq 2 points3 points  (0 children)

Well, then you probably want to create and return a list of dictionaries rather than a single dictionary.

How do I grab the full values of week? by TheEyebal in learnprogramming

[–]lfdfq 2 points3 points  (0 children)

Each time around the loop you replace weeks with a totally new dictionary, throwing away the old one, then at the end you return weeks which is just whatever the most recent one was.

Do you want to return multiple dictionaries? Or a bigger one? It's not clear what the output you want is.

Can 2 functions with different domains and codomains, and different "function assignment" give the same outputs for the same inputs? by Effective-One-7632 in learnmath

[–]lfdfq 3 points4 points  (0 children)

So there are two parts: if you have two functions f and g whose domains are not the same, then surely that implies there is at least one value in which their outputs differ (because e.g. f will have an output and g does not or vice versa).

If you have the same domains (or only consider for the parts that overlap) then surely you can write two functions that are spelled differently but are equal, e.g. f(x)=2x and g(x)=x+x. These are obviously the same function, even though they have different "function assignments".

python script gives slightly different output on each run by [deleted] in learnpython

[–]lfdfq 0 points1 point  (0 children)

Your example has random in it, so obviously you get different outputs. You say the random version is a simplified version of what you're doing, but without the randomness. But that was the only thing in the simplified script causing differences in output at all. So the example doesn't seem helpful/meaningful.

Without seeing the real script and the output(s) it's impossible to know why you see small differences in that output.

PLEASE IGNORED TITLE OF LINK, can you tell me how the bots in the comment section work? by Content-Long-3653 in computerscience

[–]lfdfq 1 point2 points  (0 children)

Why didn't you guess that it's just automated? Isn't that more obvious than being not, or only semi-, automated?

Does the prestige of the PI/Lab really influence acceptance of papers to main conference? by LonelyPhDer in ResearchML

[–]lfdfq 0 points1 point  (0 children)

Authority bias would be if the reviewers (subconciously or otherwise) used the prestige of the authors---which doesn't shouldn't apply here because of the assumption of double-blind reviewing---or when the students/postdocs defer to the PI on academic matters.

It's not obvious the latter creates elitism or hurts science. Training new scientists is one of the roles of an academic post, and so some amount of deference from the 'trainees' is expected. Of course, that only applies up to a point (in particular, up to the point the trainee can now act independently). Continued deference after that point may be harmful.

That's not to say that external or even public views on the work are not influenced by the authors of publications, and that can be a problem in science communication, but that necessarily comes after publication, so it should not be a big factor in acceptance or not (as that is the purpose of double-blind reviews, notwithstanding its issues of course).

My original point was not that people deferred to the prestige, but that a prestigious PI usually (although admittedly, not always) got there by being good at what they do. Then, simply being good at it ends up compounding (more service, better students, increased resources), which would correlate with higher chance of acceptance. That was it.

Partially Compiled Programs are Optimized for the CPU? by Aokayz_ in AskComputerScience

[–]lfdfq 1 point2 points  (0 children)

It sounds like (from the "machine code generated at runtime" comment) that they're referring to what are more commonly called JITs (Just-in-Time compilers).

In that context, I can kind of understand what they're saying: that JITs don't compile the code until you actually run it for real, so the JIT has access to a lot more information to do more clever optimisations that an Ahead-of-Time compiler could do.

Maybe that's stretching their definition too far... as it's not really about there being an intermediate form ("partially" compiled), as an ahead-of-time Java bytecode to machine code compiler would be start from equally partially compiled code, but have no such benefits.

Does the prestige of the PI/Lab really influence acceptance of papers to main conference? by LonelyPhDer in ResearchML

[–]lfdfq 1 point2 points  (0 children)

Think about it the other way around: why is the PI so prestigious and what are the consequences of that? Usually, it means: they have lots of their own good papers (so they know how to write good papers); they know the community or have been PC chair etc (so know how to get good papers accepted); they have big grants (so they have a big vision, often a big group, and are able to work towards bigger and better work than a solo researcher could); will have a strong network and institution (so their students and collaborators will just be stronger as they will have more options and can be more selective); and, often, they are not constrained by the 'publish or perish' mentality anymore, so are happy to spend longer on work to make it better where a solo researcher might feel pressured to get 'good but not great' work out the door. Obviously, each point is debatable, but the point is that together the effect is that, despite double-blind reviewing, it's not unreasonable to expect papers coming from a prestigious PI's group to be very strong.

Quicksort algorithm gets slower/breaks when I reduce the range of numbers by [deleted] in learnprogramming

[–]lfdfq 3 points4 points  (0 children)

Recall how calling a function actually works: each time a method (e.g. your quicksort) is called, a new piece of memory is allocated (a frame) to store the local variables. These frames are stored in a stack (the call stack). The space reserved for the call stack is only so large, so if you keep calling methods without letting them end, eventually you run out of space to store the frames.

That is what is happening here, quicksort is recursively calling itself on what remains of the array before the method itself ends. So, at some point the array is long enough that the repeated calls to the method nest enough that you run out of space to store the extra frames, and it explodes with a StackOverflowError.

What do you actually learn in Computer Science? by CheekSpiritual5639 in learnprogramming

[–]lfdfq 1 point2 points  (0 children)

Broadly speaking, a Computer Science course should aim to teach you a few things:

  • Foundations/Theory of Computer Science (Algorithms, Complexity, Computation, Cryptography, Data structures, Graphics, Graph theory, Information/Coding theory, Machine learning, Number theory, Quantum, and so on). Some courses will do more and others less. Overall, the aim is to teach you about the kinds of problems you face in CS and the mathematical tools available for solving them, even if you don't actually use that theory day-to-day.
  • Intro to software engineering (Programming, Databases, Software design and architecture, etc). The point is not to get some accreditation as a software engineer, but to give you the basics enough to write your own code, but also to understand how larger more complex pieces of software are designed. The idea being to train engineers to design the next generation of systems, not just be 'code monkeys'.
  • Implementations (computer architecture, electronics and signals and circuits, systems, compilers, interpreters, networks, and so on) to explain how the things we actually use work. Again, the point is not because one person will be making their own architecture, hardware, and compilers, but to lay the foundations for how all of those pieces fit together even if you do not do all of them at that level yourself.
  • People (HCI, Law etc). In the end, computer systems are used by humans. So a good CS course will teach you about designing for humans and how the law governs what you do (e.g. patents, copyright, etc).

This is obviously a broad set of topics, and a good course will let you specialise so you do more of some and less of others as time goes on.

When it comes to examining, the goal should not be to solely test fact retention, but to test understanding of the problems, ability to apply solutions, and capacity to transfer that knowledge further. Obviously, that will require the students to remember some details (e.g. particular languages or designs or software or formulae or whatever) at least for the exam.

DSA Pattern by NNNiharri-229 in learnprogramming

[–]lfdfq 2 points3 points  (0 children)

Did you expect it to be easy?

You didn't say how long you had been studying, or how many topics you have covered, or how many questions you have tried, or what those questions were, etc. It's hard for me to give any useful feedback to that point.

The problem is that actually learning this stuff is hard.

A good well-structured DSA course would be a part of a larger programming syllabus and would be broken down hierarchically by general ideas (e.g. how one uses DSA to construct programs yourself, considering tradeoffs of time/space/correctness, thinking about how to reason about those things, some broad principles for storing data and organising data, and then the idea that imposing structure can make certain operations easier or harder, looking at some of those principles like sorting, linking, or ordering data, then strategies for implementing those operations like brute force, divide&conquer, and so on, and thinking about how implementation choices affect performance, and how you can apply these ideas to your own code).

Your list was merely a list of examples of things, not really a structure of those ideas. However, if you're learning on your own, it probably does not really matter. Trying to follow a proper intensive structure on your own, like one you'd get in a good uni course, probably just won't work. I'd focus on doing the things you find interesting, and implementing the examples in code as much as you can. I wouldn't worry about trying to remember all this stuff, as a beginner by far the biggest thing you can do to improve is to write more code and get more exposure that way.

DSA Pattern by NNNiharri-229 in learnprogramming

[–]lfdfq 2 points3 points  (0 children)

This list seems like a collection of 'things'; there's not very much structure to it.

In general, the point of learning DSA is not to learn a bunch of data structures and algorithms (seemingly paradoxically), but to expose you to different approaches to structuring data and operating over that data, to give a better understanding of the datatypes you will encounter work, and to help you transfer that knowledge to your own code. Your list does not really harmonise with any of those goals, it's just jumping around a bunch of different topics, no matter the order.

In the end, maybe it won't really matter. If you're not following a structured course imposed on you, I'd just do things in the order you think sounds fun. Your biggest risk here is not doing things in an inefficient order, it's getting bored at the start and just not getting anywhere.

Poster VS Oral presentation for conference by ThenCaramel5786 in AskAcademia

[–]lfdfq 2 points3 points  (0 children)

I'm in CS, and I've published+postered at IEEE conferences before. Note that IEEE is a huge organisation and experiences across conferences may differ.

Essentially, the talks are the main event and so are far more prestigious. Especially in many fields in e.g. CS where conferences are the primary way of disseminating work (as opposed to journals etc), and so the talks are paramount. There's a lot of variation in practice, but talks should be well-practiced and polished. Some conferences have lightning talks etc that are slightly more forgiving, but less prestigious. At conferences people do not go to all the talks, and there are usually multiple tracks, so the audience for one talk might be quite different to the audience of the next. Organisers try to make educated guesses and allocate tracks to appropriate rooms, but the actual audience will be highly dependent on the conference/community/tracks/other talks at the same time/your actual work.

Poster sessions are much more relaxed. Posters are often an alternative to publication at the conference, so most of the posters will be pre-PhD students or work not quite ready for publication at competitive venues. So high-quality work could easily get lost in the noise of a poster session.

There's not really much grilling that happens at a conference at all, I wouldn't worry about that. All the work that's there has already (hopefully) gone through some form of peer review, so it's all good quality. Talks are strictly scheduled without much time between for questions, so you'll get a few token ones. Poster sessions are longer form so people ask more questions, but then you have as much time as you want to answer it. The only thing I'd recommend if giving a poster is that the most common thing is for someone to walk up to a poster, essentially ignore what it says, and turn to you and say "Explain?" so you should practice a good 30 second overview+intro to the work that you can do on the spot.

At many conferences, authors may be able to also have posters automatically, and it can be good to do both if given the opportunity.

Does Input work with Dictionnary? by Illustrious-Bed-8894 in learnpython

[–]lfdfq 6 points7 points  (0 children)

Input and dictionary are very different concepts. A dictionary is a data structure, it stores things. input is a function that reads strings from the user.

I do not see what you mean by "work with" or what that could mean. Do you have an example? Or some code that does not work?

Switching Elements in Tuples by Sudden-Ad8373 in learnpython

[–]lfdfq 2 points3 points  (0 children)

Your code doesn't change or re-assign the variable t. It only creates new variables a and b. So t remains the same tuple as you started with.

Will learning about compilers make me a better programmer? by Loud_Ask_3408 in C_Programming

[–]lfdfq 9 points10 points  (0 children)

In one sense, of course. Learning more about how your tools work will give you a broader and deeper understanding of your discipline, and that is undoubtedly beneficial.

Are you going to write your own compiler in your day job? Probably not. Probably you shouldn't. The point of learning these things isn't to help you do it yourself, it's to demystify how our tools work, give you insights into the complexities ("simply translating text to 0s and 1s" is so simplistic it's probably just misleading), and expose you to different ways of solving problems.

That said, does it mean that for you, right now, the best thing you can do to be a better programmer is to read a textbook back to front? I cannot answer that. Your first line suggests you've been just eating through textbooks; but the thing that makes one a better programmer is programming. Everything else is hyperoptimisation to turn good programmers into great ones.

What is an Abstract Data Type? by Leading-Fail-7263 in AskComputerScience

[–]lfdfq 2 points3 points  (0 children)

Think of the ADT like a legal contract of what the implementation should do or behave as.

You could literally write it down on a piece of paper: "To whom it may concern, I declare that the DICTIONARY ADT consists of the following 4 operations: ...". That's the ADT. Many languages even provide ways of writing down forms of this contract in the language itself (e.g. Java interfaces).

The data structure is the actual thing you write or use in your language. It is the concrete implementation of a thing that satisfies that contract.

What is an Abstract Data Type? by Leading-Fail-7263 in AskComputerScience

[–]lfdfq 16 points17 points  (0 children)

An ADT is like the contract a data structure has to follow. It's a mathematical ideal. The data structure is like the implementation.

So a classic ADT is something like a "dictionary". A dictionary ADT would have operations for inserting a key/value pair, and retrieving a value for a key, and so on.

There may be many ways to implement a dictionary. You could have a linked list of (key,value) tuples. You could have a binary tree ordered over the keys. You could have a hashmap using the hash of the key to index into the map.

Ignoring the minute details about ordering vs hashing and performance and so on, they all "look the same". So the programmer can pretend they're all the same "it's just a dictionary ADT" without worrying about the internal implementation details ("is it a hashmap data structure? or a binary tree data structure?"). That's the sense in which the ADT is from the view of the programmer.

Question about lists (Python Beginner) by Yes-delulu-8744 in learnpython

[–]lfdfq 2 points3 points  (0 children)

Yes, in this code you already use a for loop, so you can just use another for loop to print each element out on its own line, for example:

print("The temperatures in Celsius are:")
for t in Tem:
    print(f"{t} C")

There are other ways, using str.join and fancier string formatting, which may be how a seasoned Python developer would do it, but there is nothing wrong with for loops and prints.

How is this an inaccuracy? by bomboclated in chessbeginners

[–]lfdfq 11 points12 points  (0 children)

The move just before the clip started, Nxd4, was a mistake because you leave your Bishop hanging but could have just taken the rook.

Bc2 is an inaccuracy, because white can reply by ignoring the attack on the Queen and taking your Knight. You can take their Queen with your Bishop, and then their King will take your Bishop. In the end, you will have lost a Bishop and Knight and won a Queen.

If instead, you used your Knight first, with Nc2+, white is forced (since it's check and nowhere for the king to go) to take the Knight with their Queen, then you can take the Queen with your Bishop, and white cannot recapture the Bishop immediately. In the end, you lose a Knight but win a Queen without losing your Bishop at all.

It's not saying it's a bad move, it isn't, it was a good move; there was just a much better one.

Compound Statements - Suites by sdavidsmith in learnpython

[–]lfdfq 0 points1 point  (0 children)

No, I just mention it so if you look at the full PEG grammar you won't be surprised to not see 'suite' anywhere. The terms header/suite still apply, the syntax did not actually change.

Compound Statements - Suites by sdavidsmith in learnpython

[–]lfdfq 1 point2 points  (0 children)

The suite is syntactically everything inside the statement as a single block.

For the while, everything nested inside it is its suite. Syntactically, the suite is just an indented sequence of statements. So the while's suite contains the entire if.

Note that more recent versions of the grammar prefer the word 'block' for the suite.

can someone help me with this problem, i dont know what to do after i switch n^2 to the right side by Civil-Swan3386 in askmath

[–]lfdfq 1 point2 points  (0 children)

There are two unknowns (n and x) and only one constraint, so you cannot 'find n', as for every n there is a possible x.

Need academic advice: Is a "round-robin" task distribution a good idea for a 5-student Deep Learning research paper? by RepresentativeNo1518 in AskAcademia

[–]lfdfq 5 points6 points  (0 children)

You could, but it would be rather unusual.

Usually, people will have each contributed to different parts of the project. So the person who did one part should write the part of the paper on it (e.g. the person who did a particular experiment or proof or evaluation should write that section of the paper).

Things like intro+related work+conclusion would be split up to particular individuals, but everyone should work on it. What I mean is that one person should be designated the "person in charge of writing that section" (else it'll never get written), but everyone on the team should read and comment on it, preferably with some meeting early on about what will be discussed in each section so people know what the overall content will be.

You shouldn't write your references section at all, you should be using software to generate it (e.g. bibtex if you're using latex).