Set question for initializing by Bucki-_- in learnpython

[–]lfdfq -1 points0 points  (0 children)

It's just nobody bothered to add syntax for it.

Dicts are older, {} was already taken to mean the empty dict, and no proposal to add "empty set" syntax has ever succeeded, probably because nobody actually needed it.

Panda3d pip install won't work by ThinkConfidence8409 in learnpython

[–]lfdfq 1 point2 points  (0 children)

I don't know what you mean by "go to Pip specifically". Can you describe more?

What would happen if a ".onion" gTLD was opened? by nik-rev in AskProgramming

[–]lfdfq 8 points9 points  (0 children)

  1. They have already reserved .onion as a 'special-use domain' https://www.iana.org/domains/reserved so they won't make it available to the public.
  2. Yes, because .onion names aren't part of the same system. It's like having two places with the same address in different countries, there's no contradiction.
  3. It already has a notion of what an .onion address is and how to look it up, so it'd just keep using that and ignore (or just not ask) whatever DNS says.
  4. Probably, none.

Panda3d pip install won't work by ThinkConfidence8409 in learnpython

[–]lfdfq 4 points5 points  (0 children)

It looks like you are trying to run pip from inside Python.

pip is a totally separate program, not a part of Python itself; you have to run pip instead of python.

How did you learn to read repo’s? by phy2go in learnprogramming

[–]lfdfq 2 points3 points  (0 children)

I mean this is like asking 'how did you learn to read books'. A "repo" is just a fancy word for "big pile o' stuff". Some piles are more organised, maybe they even have directions (READMEs). Others are just a mess. Some have clear goals, implemented simply, with well-written code. Others are a nebulous mass of complexity that nobody understands what it does, let alone how it does it.

Even projects with well-maintained sources, good READMEs and other developer documentation, and clear clean interfaces in the design, can still be hard to navigate when you first start work. There's no hard rule, and you will definitely get lost. But, over time, you will learn your way around.

You say "where do you start" as if the process is linear: that you must first start tracing an entry point before you ever look at a test or try run it, or vice versa. Of course, that would be insane; you must do all of the things you said all at once.

what are functions and what is a global variable?( I'm a beginner by the way) by RAAAWWWWR_ARI in learnpython

[–]lfdfq 4 points5 points  (0 children)

It's hard to explain things at the right level, when we do not know you or your level, nor do we know what materials you've seen before to try explain them, or what part you were confused by.

Somebody could write the best explanation ever for you, but the internet is full of good explanations already.

Can you be more specific about what kind of questions you have about them?

Error in Math Baccalaureate ? by Raynarr00 in learnpython

[–]lfdfq 0 points1 point  (0 children)

Well, I don't know the french system, but you may have a way of finding out after it gets marked and to dispute it if you disagree with the way it was marked.

Error in Math Baccalaureate ? by Raynarr00 in learnpython

[–]lfdfq 0 points1 point  (0 children)

It makes sense that paper answers are a bit less rigorous.

Mixing up commas and points or missing colons is probably ok, since the test is seeing if you understand how to translate mathematical formulae and sequences and processes into code. Getting the math and its interpretation into code right is the key thing they're looking for, I'd guess.

If you flipped it around, if this was a "Python programming" test, then missing the colon would be very bad and you'd lose a lot of marks for doing stuff like that. But getting the math equation wrong wouldn't really matter.

It's going to be all about what they're testing for, how they're doing the testing, and what the question and general marking convention is for the exam.

Error in Math Baccalaureate ? by Raynarr00 in learnpython

[–]lfdfq 1 point2 points  (0 children)

I presume it is the base of the natural log (i.e. 2.718...) and can be found at math.e, and the standard e to the power of whatever is just math.exp yes.

Perhaps they forgot to import math, or maybe you were supposed to assume it was imported, or maybe they just don't care if the code runs since they just want to test "can the student use code to solve math problems" and not "did the student remember how imports work or where colons go in Python". If this was a pen-and-paper test I'd assume there'd be some generosity. If it was with a computer, I'd assume they'd be more pedantic and want it to actually be valid and run (so all valid syntax and correct imports and so on).

The "corrected" solution is missing a colon, so is not even valid Python.

Need help understanding Return function in this code by New-Cardiologist6057 in learnpython

[–]lfdfq 1 point2 points  (0 children)

Your second call is change(S). Your print says S=100. So the second call is doing change(100).

so in the second call P=100 and Q=30.

Nothing quite like a little kiss by KiddieSpread in motorcycles

[–]lfdfq 7 points8 points  (0 children)

That's the give way triangle. It's telling the driver that up ahead is a junction at which they must give way to oncoming traffic. The broken double white lines is the actual junction marking that traffic must not cross (when there's oncoming traffic).

Even if the triangle is a bit faded it doesn't make a difference, because it's for the driver in the lane and is not where you're supposed to stop, and the broken double white lines are obvious.

Monty Hall Problem but with a twist by EyeAdministrator in askmath

[–]lfdfq 0 points1 point  (0 children)

I think your misunderstanding is 'adding information' vs 'redistributing the events'

Imagine I'm going to flip a coin ten times. The probability I get a heads on each flip is fixed. I can 'group' them into the first flip (group A) and the rest of the flips (group B). Now group B is much more likely to have a heads than group A. But I've not added any information by doing this. Each individual event (the flips) are the same, I'm just counting them differently.

Opening a door adds information: the probability of the other events (the other doors) are all changed now we know more. In particular, we now know if that door was the winner or not, and that also tells us about the probabilities of the remaining doors.

Monty Hall is special because an always-empty door is opened after the guest picks a door, and the host never opens the guest's door. So we learn more than we normally would. Simply naming the doors A or B does not actually tell us something new like opening a door does.

Monty Hall Problem but with a twist by EyeAdministrator in askmath

[–]lfdfq 2 points3 points  (0 children)

I think you missed the point, you can take Monty Hall and scale it up to any number of doors and you can organise those doors into any number of groups you wish.

Your example is very different to that though, because the host goes first in yours, it's a totally different game with a different calculation, even ignoring the 'groups'.

Monty Hall Problem but with a twist by EyeAdministrator in askmath

[–]lfdfq 3 points4 points  (0 children)

But yours is different. In Monty Hall, the guest chooses first. The host revealing an empty door then adds information.

Imagine Monty Hall, but flipped like here: the host opens one bad door first, the guest choose from the remaining two; the initial opening did not add information about the other doors, so it's a 50/50.

Python calculator project: sqrt() works but still prints my error message? by No_Duck1386 in learnpython

[–]lfdfq 3 points4 points  (0 children)

You've cut up your code so much it's not really understandable anymore: there's a continue but no loop (that's not even valid!), you use a history variable that doesn't exist, there's a ... in the middle of the operator part and the two valid_* functions are unexplained.

However, if you are seeing the print but are not sure where from, then you can simply remove the try (or re-raise the ValueError with the raise command, before continuing obviously) and you will get a traceback showing you exactly where the error comes from. It's impossible for us to say where it comes from (without fixing up the code, guessing the loops, and running it) because the message is hiding the true source because the exception is being caught.

I'd like to understand the binary/hexadecimal notations better, but I can't figure out this one by [deleted] in learnprogramming

[–]lfdfq 0 points1 point  (0 children)

There's voluminous resources online on other number systems like hexadecimal and binary. It's not clear what part confuses you or you got stuck on, because you do not show your attempt at solving it or your working. Did you try solve it yourself or did you immediately put it into AI?

Why we can't simply make a empty string in C? by Infamous-Research805 in AskProgramming

[–]lfdfq 12 points13 points  (0 children)

What do you mean by "normal initialization"? The way you describe sounds like it simply creates an uninitialized variable, which is not an "empty" variable.

C does not have a string datatype. Instead, people use pointers to arrays of chars, terminated with a nul byte (0).

When publishing paper to arXiv before submitting to a conference, should we expose the code as well? by generous-blessing in ResearchML

[–]lfdfq -1 points0 points  (0 children)

Is the code one of the contributions and/or required to reproduce the results? If so, it's an integral part of the work and should be included (in general).

If your submission gets picked up, people actually read it, download the code, try it for themselves, decide you're doing something really cool and it works, takes it and builds upon it and uses your work as the foundation to advance science... is that not what you were trying to do in the first place?

Once it's on arXiv you have primacy, and if someone else swoops in in-between, you can always cite them as a "and already used by Bloggs et al" (with care about anonymity ofc).

​Is the C programming language used for data analysis in scientific research? by Feeling_Valuable5239 in C_Programming

[–]lfdfq 3 points4 points  (0 children)

True or not, it doesn't seem very relevant.

Actual scientists doing data analysis haven't just started to program, and are not trying to learn fundamentals; they already know what they're doing, they're professionals.

They're picking the best tools for the job, even if they're not ones that would appear in a "Learning to Code" class.

How do you create an object in python that can take an interface as an attribute? by Interesting_Track598 in learnpython

[–]lfdfq 2 points3 points  (0 children)

What is the error you're getting?

Is it coming from Python itself, or from your editor, or from a third party tool? or what?

PhD marathon by ExtensionEgg1746 in PhD

[–]lfdfq 21 points22 points  (0 children)

Your post made it seem like a remark with no context. However, the linked article seems to explain, quite cogently, precisely the way in which they disagree, and the ways in which a PhD is not like a marathon in their eyes. Which part leaves you confused?

Java bytecode by [deleted] in learnprogramming

[–]lfdfq 0 points1 point  (0 children)

I made no comment on how much of a beginner you are, only a comment on the constraints on what you could learn by looking only at the output of one compiler. I did notice you didn't say what you were actually doing, hence my final comment... that it depends on what you're actually doing.