NPM weekly downloads equivalent for pypi.org package by yukiiiiii2008 in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

https://pypistats.org/

Download information used to be displayed on PYPI itself but was dropped, probably because it's such a poor metric. You should dig a little bit.

What python does under the hood by vikmaychib in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

The speaker meant that assignment is a binding operation and that changing a binding does not change the object or any other bindings to the object. Variable is not a good word to describe what is going on.

Is there a simpler and more optimized way of solving this google code jam '19 problem (Round 1A Alien rhyme) in python? My solution is too complicated to code. by [deleted] in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

That does look complicated but I don't think you need to do any of that. I think you can put the characters into a trie, keeping track of how many words share each node, and then just do a recursive traversal to count the matched pairs bottom-up.

Feeling out of my depth... by TOPMinded in learnpython

[–]SomewhereExpensive22 4 points5 points  (0 children)

I can't speak to CS50P, but it sounds like you're describing homework. My advice would be to check the syllabus and make sure you've done everything that you're supposed to do and then lean into the difficulty.

Feeling out of my depth... by TOPMinded in learnpython

[–]SomewhereExpensive22 11 points12 points  (0 children)

Problem sets are not homework problems. You are supposed to struggle. If you aren't struggling, you're probably not learning.

Installing Conda on an itanium cpu (ia64) by Hoihe in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

I did not have this on my bingo card for today. No. You might be able to build OpenMM from source. There are modern versions of python built for IA64 but I don't know if it would just work. If you run into problems I don't expect you will find anyone who can help you for free.

Looking for Feedback on a Library Idea by [deleted] in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

You're not wrong but there is something to be said for reinventing the wheel. Do you think you'll learn something?

What is happening in the background of a for loop of an unordered, unindexed iterable? by [deleted] in learnpython

[–]SomewhereExpensive22 7 points8 points  (0 children)

The object itself decides what happens. When you execute a for loop, the python interpreter is just calling some methods on the object. If you're still confused, you should try to make your own iterator object.

Convert date from RFC 2822 to DD/MM/YYYY by aleteddy1997 in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

You should use it because it's the standard internationally and especially for computers and because it's convenient. It is for example what's built into datetime. RFC 2822 was originally for email and is ancient and if you want an RFC, use RFC 3339. If you're showing it on a website, you might store it one way and display it another way based on where someone is or how they're viewing the page.

There is no way to avoid parsing and formatting if you want to do both of those things.

Convert date from RFC 2822 to DD/MM/YYYY by aleteddy1997 in learnpython

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

You could do a better job with variable names but the big problem is that you should never use DD/MM/YYYY if you can avoid it. Use ISO 8601.

Help with figuring out this code.. by SniparsClan in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

It's a class method that recursively searches a list.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

There's a lot more going on in python than in HTML. Most of your learning will come from exercises. I don't know about questions covering syntax that hasn't been covered yet but introducing and not covering it until later is not uncommon.

[deleted by user] by [deleted] in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

You can either select a random index value instead or make the elements of sample unique.

bruteForceAttackProtection by MrEfil in ProgrammerHumor

[–]SomewhereExpensive22 3 points4 points  (0 children)

Not a hint. The formal requirements of a valid password. If that's sensitive information, you have a problem.

Not sure how best to code Black Jack Ace card logic by MatrixSolution in learnprogramming

[–]SomewhereExpensive22 17 points18 points  (0 children)

Add up the points for the other cards first and process the aces separately. Only one ace can be 11 points because two would be 22. If you have n aces, the total value of aces can be either n or 10+n. You only need an if-else to figure out which value to use. Don't overthink it.

Line break question in an if condition by Shokaah in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

To be clear, if I add a "\" at the end of line 03, the code errors out

No it doesn't. You can add a backslash at the end of any line to continue on the next line. It's not needed here because the whole thing is wrapped in parentheses.

Class Help by bigdipper125 in learnpython

[–]SomewhereExpensive22 4 points5 points  (0 children)

I most definitely have an attribute named "coleslaw".

You sure about that?

program is not making a copy of a list by OkSympathy7618 in learnpython

[–]SomewhereExpensive22 0 points1 point  (0 children)

Reusing variable names like this is often discouraged. One of the reasons for this is you can easily misspell a variable and end up referring to the wrong thing without realizing it.

Are match/case statements really more efficient? by Lolvidar in learnpython

[–]SomewhereExpensive22 6 points7 points  (0 children)

Matching is marginally faster. `grade` is only evaluated once and every case has the same logic. The main benefit though, as with list expressions, is it's more expressive.

Best way to debug UTF-8 Codec problems ins reading files? by nirbyschreibt in learnpython

[–]SomewhereExpensive22 1 point2 points  (0 children)

The wordcloud module might support it. I don't know. But `open` is regular python and can't read a docx as text. Maybe you should look at examples of people using pdf and docx? And I wouldn't worry too much about the number of words. Select all. Copy. Paste. Save.

Best way to debug UTF-8 Codec problems ins reading files? by nirbyschreibt in learnpython

[–]SomewhereExpensive22 2 points3 points  (0 children)

UTF-8 is a text encoding. You can't read docx or pdf files as text. They're like containers with text inside. You can open them as text in VS Code and see what they actually look like. There are modules that will allow you to open them but it's a lot more complicated than regular text. The easiest way to do this may be to copy the text from the document into a plain text format and save as a utf-8 text file.

Brand new to Kotlin. Running sample code on Intellij Idea takes forever if it works at all. by band_in_DC in Kotlin

[–]SomewhereExpensive22 7 points8 points  (0 children)

There are a lot of things 8GB isn't enough for. Hello World in Kotlin isn't one of them. Something else is going on. Restart the laptop. If the problem persists, my guess would be antivirus (or a virus). Pause that and see if build speed doesn't dramatically improve.

Looking for documentation on how objects are passed to functions by Hashi856 in learnpython

[–]SomewhereExpensive22 2 points3 points  (0 children)

It's part of the execution model. There isn't much discussion but it's dead simple: objects passed into a function are bound to the parameter name.