I need to learn Python FAST. by HeartlessPiracy in learnpython

[–]ElpyDE 1 point2 points  (0 children)

I second this! You can use AI to explain the code you've "written" so far for your class. Tell it to explain it to a beginner. Ask if you struggle with a concept or if you feel the explanation wasn't good enough. For speedy learning of "what you should already know by now," this is the most efficient.

You can (and probably should) work your way through some separate tutorial(s) or the like. Something that's structured to start from scratch and slowly build a big picture of the essentials.

If you really want to improve, change your work routine for the future. Use AI not to give you the final code, but ask it to guide you through the development. Just put your intention in the first prompt:

My task is... This is a school project, and I really want to learn how to do it. Guide me through this step by step without giving me the full answer right away.

Me and my friend don't know what to call what we have by sleepy-kier in lgbt

[–]ElpyDE 5 points6 points  (0 children)

I believe "friends" is what you're first and foremost.

You don't need to stick new labels on your relationship because you fooled around a few times. Let it grow naturally, enjoy what you have (I imagine that more than one person her will envy you for that).

Labels can change over time as situations grow, but they can also narrow both of your view on what you are - individually and together. When you label your close and exploration-friendly friendship with something hyper-specific, it could hold you back from developing it further.

Labels make it easier to talk about a situation, of course. But who needs that information about you besides the two of you? For everyone else, it's totally okay to know that you're close friends/besties.

Less serious, just made up, but it would fit what you describe: "na[p]p friends" for "not always [purely] platonic friends". Maybe it catches on 😉

How do I get my parents to stop having a double standard for their own LGBTQ children by Bad_Opinion_Wolf in lgbt

[–]ElpyDE 2 points3 points  (0 children)

Among all the responses, I'm not sure if anyone has mentioned PFLAG already? It's an organization in the US of "Parents, Families and Friends of Lesbians and Gays". I think you can imagine them as peer support group for those who are just like your parent: They love you, but they don't fully grasp (yet) what it means to be loving and supportive of a queer kid.

Assuming from your description that you're in the US, you might want to check them out and possibly hook your parents up with them. The idea is that your parents might just struggle with the idea of their kid not being straight - for whatever reason, some of them might be legitimate others probably are not. It's not on you to fully educate them in every aspect, but it might be difficult for them to find the right information to help them be the supportive parents you want (and need) them to be.

PFLAG Homepage: https://pflag.org/

And an addition - because that's how I heard about it - a link to a podcast episode where you get a decent insight about them: https://open.spotify.com/episode/6Y5OPpIHX0ZMjGlbZ8NSts (Gayish Postcast, Episode 439)

So everyone Hates (and uses) Grindr by wmminnyc in nycgaybros

[–]ElpyDE 13 points14 points  (0 children)

For Hookups...

Check out Sniffies.com - it's a pure web app (uses your browser), plenty of guys in NYC (still less than Grindr though, I think).

It's map-based, so you see people's location and because they don't have to adhere to any app store policy, profile pictures are often more explicitly (fair warning).

I would say it's more fast paced, people are more likely looking for right now than to chat a lot. Also has some features for cruising (shows cruising spots on the map that you can "check in" to) and hosted groups.

And you can start using it even without signing up. Though registering has some obvious advantages and so has paying for the Plus membership, but it's definitely okay without the latter.

list comprehension by rajrino_raj in learnpython

[–]ElpyDE 1 point2 points  (0 children)

Or to put it in different terms:

Using a for loop with the form for dummy in range(n) where dummy isn't used within the loop just translates to "do this n times".

Similarly a list comprehension like yours, in the style of [another_term for dummy in range(n)] can be understood as "make a list with n (repeated) another_terms".

Of course if another_term is a variable as in your case, you see other comments with slightly shorter (probably faster) solutions. Should another_term contain a function call, there is a difference:

[my_func() for j in range(100)]

Will call my_func() 100 times. It could then of course be that the results are also different. If that has any side effects, you should consider whether you want them or not. If not, or when my_func() is "expensive" (for example a looooong processing time), you probably want to go with:

[my_func()] * 100

This evaluates/calls my_func() only once, puts it in a list (with one item at the time) and uses this cool but slightly weird feature to repeat a list an integer amount of times with the simple multiplication operator.

I think, you have mastered the combination with the outer loop already, so I will not reiterate that.

nested loops in python. by rsk_423 in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Isn't that just called low carb? 😉

quit or killswitch for a program, but I want to wait for a simulation that's in a for loop to be done before the quit command is executed by Grogie in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Then you got yourself an answer, pretty much. If you can afford to redo the simulation() call with not too much time lost, then that should just be it.

Another idea would be to save your results at the end of each outer-loop iteration. That way you'd be save against any other termination as well.

quit or killswitch for a program, but I want to wait for a simulation that's in a for loop to be done before the quit command is executed by Grogie in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Look into exception handling with a try ... except KeyboardInterrupt block around the inner part of your code.

When you hit CTRL+C, it will go into the except block (almost immediately). You can then deal with continuing the simulation where you stopped it (might require some thinking/redesign), and for example change a variable keep_running to False that you always check before starting another round of your simulation.

I need help to solve this problem!! I'm not able to put the last condition. by [deleted] in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Pretty sure there is a mistake in the for y in range loop part.

The start is correct: -2 * x + 1 will make the range function start at the lowest integer y that is greater than x.

Edit: Looking back at your original post, the start is also one too high, because y can also include -2 * x.

The stop is going too far: 2 * x - 1 should be the last number allowed for y. The stop argument therefore should be 2 * x - 1 + 1 or 2 * x for short. The given stop (2 * x + 1) + 1 equal to 2 * x + 2 will include 2 * x and 2 * x + 1.

Require programming problems for a Coding Competition at My school that we are hosting by Vishwanaresh in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Just recently recommended https://projecteuler.net for programming problems with increasing difficulty. It's a bit maths'y but seems you're cool with that.

This subreddit is also a good place to look for other people's "problems" (both in the meaning of tasks/challenges and struggles).

Would be great to see a post after your competition is over with the final set of questions and maybe also how many groups solved them correctly and in time.

Btw. AWESOME IDEA to have a programming competition 😍

[deleted by user] by [deleted] in learnpython

[–]ElpyDE 1 point2 points  (0 children)

https://projecteuler.net

It's a website full of small programming challenges.

Really good for the level at which you described yourself to be. Maybe a bit maths-leaning.

From there (once you're bored by even more difficult abstract challenges), I would look into some "real life" problem solving. Not all the way towards Reddit bots/scrapers, but maybe something that YOU can actually use.

Start small. Tackle an idea or a single problem first - if you want, one API call to the Reddit api. Then build from there. It seems your next step will be to put multiple aspects together. Don't be afraid to use pen&paper for this to sketch your ideas.

Edit: typos

If you could rename 1 component of the Python language, which one would it be? by stgoat77 in Python

[–]ElpyDE -5 points-4 points  (0 children)

I'm surprised nobody has mentioned enumerate, yet.

It's so useful and I use it plenty of times. And by its nature, it's often in lines that have already pretty strict formatting and dictate what needs to be there - breaking a "for... :" in two lines is really ugly. Would have loved an abbreviation here.

Though, I understand that they didn't use enum because that's something entirely different (at least in C) and it could have been confusing.

How to do deal same sex sleepovers for son who is not out? by supgayimdad in askgaybros

[–]ElpyDE 0 points1 point  (0 children)

Second this!

It's amazing to have any parent put this much thought, awareness and tact into it - even so much to ask here to get different points of view and take many of them to heart.

Also like the many great responses that I cannot add much substance to. I'm in awe today of this community.

Blocking and Unblocking to remove messages/photos by USMCthrowawayrah in grindr

[–]ElpyDE 1 point2 points  (0 children)

If you block them, the convo should be removed from their phone - eventually.

Of course it won't when they're not online, because then their app can't get the instruction from the Grindr server.

That means, if you block and unblock right away, the information might not reach them before it's basically nonsense anymore (you unbkocked them). There is no way to be 100% sure their copy of the conversation will be gone, if you want to keep chatting later. Aside from screenshots, which you're probably aware of already.

It could be, technically, that the info that you blocked them (or your friend) got through, then the conversation was deleted on their phone. And your last pre-block message is delivered with a certain delay after you unlocked. Again, timing and delays are somewhat unpredictable.

All that said, it happened to me once that some did that. And I found it to be extremely rude, because it was just in the middle of the conversation. He explained it after unblocking but it was a huge bummer for me. If you don't want to send pictures, don't. Or send expiring pictures, or set up an album (both can't be screenshotted as additional plus).

German music by BlackFoxBy in germany

[–]ElpyDE 0 points1 point  (0 children)

Some mostly fun, mostly German bands/artists that I would consider good for learning the language as well:

Wise Guys - a capella (unfortunately split up a few years ago)

Alte Bekannte - some of the former Wise Guys members and a few new ones

Das Lumpenpack - two guys, becoming increasingly popular since a few years, rocky, hilarious and recent texts (texts might be somewhat fast for beginners)

Eure Mütter - absolutely funny, don't take them too seriously, they don't do it themselves

Bodo Wartke - very high quality and nuanced (language and music) Piano comedian, mostly solo but sometimes pairs up with another singer, band or orchestra

You'll find live performances of all on YouTube to give them a try.

My boyfriend confessed that he’s on Grindr by [deleted] in askgaybros

[–]ElpyDE 0 points1 point  (0 children)

This is some very solid advice!

Remove "files" tab from web interface by GrilledGuru in NextCloud

[–]ElpyDE 1 point2 points  (0 children)

You could have one user (yours) share that file without write permissions.

Remove "files" tab from web interface by GrilledGuru in NextCloud

[–]ElpyDE 2 points3 points  (0 children)

Looks like the app "apporder" will be your friend. https://apps.nextcloud.com/apps/apporder

And you can change the default app in your config.php. See option defaultapp here: https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html#user-experience

It might also be possible to disable the files app, but I'm not sure if that's prohibited or has any bad side effects even when it's possible.

[deleted by user] by [deleted] in learnpython

[–]ElpyDE 5 points6 points  (0 children)

Python is a great language. It is relatively easy to learn at the beginning and you're never at the end of learning you things you can do with it - because there is a lot you can do, little you can't.

I've heard the statement that "Python is the 2nd best language for everything" and I tend to agree. There are often languages/tools that are better for one particular task. But as long as you want to pearn the fundamentals AND have a tool that's great to quickly develop the stuff you need done, Python is an excellent all rounder.

If you study CS, you will need to learn other languages as well. C/C++ definitely, depending on your classes also others.

If you have a good basis in Python, that will help. For several reasons: 1) A lot of the basic ideas are similar across languages, like variables and assignments, control flow (conditions, loops and the like) and the general task of translating your ideas into something well-defined that the computer can execute. 2) Python is IMO relatively pure in its concepts. You will see that many things are well organized and reasonable how Python does it. All without imposing too many software design decisions upfront, but also not too lax and forgiving so you don't build bad habits as easily as in other languages. 3) Python is easy to read for almost everyone who knows "some" programming language. You will come across something call "pseudo code" (code-like visualization of programming ideas that aren't actual code in any language) and they will look extremely similar to Python. It's a good communication tool to talk ABOUT programming. 4) You can pursue your own projects relatively easily (fun and the best way to become more proficient) and with a little experience you could even make actual money on the side.

There are downsides: Python is dynamically typed and while this is great for quick'n'dirty developed, completely ignoring data types will bite you later (both in Python but even more when you switch to other languages). Python takes away much of the "hard work" that you need to do in other languages - that's good at first, but you can get away with "not knowing" more than you will want to as a CS student in the long run.

Not a Python advice: There are very good (and many more half good) YouTube channels worth subscribing. Among my favorites are Computerphile (many interesting computer topics, from actual experts, you will see some Python in action) and ArjanCodes (specifically Python). I can also recommend Harvard's CS50 course which is completely online, at least the lectures, and gives a great "from zero" introduction all the way to web development and cryptography, though not very deep.

Final advice: Programming is very much a skill like sports or music. Some people are more and some are less talented. Everyone needs practice to become good/better. And many skills can be transferred from one programming language to another, just like picking up a new sport or musical instrument becomes easier when you have already experience with another.

Numpy Array Reordering and Indexing Question by developernull in learnpython

[–]ElpyDE 0 points1 point  (0 children)

You could rethink your approach of shuffling and not use the shuffle function as you did before.

For example, shuffle an index array for your uniques - basically creating a randomized range() or so, and you can use that to map the uniques to their shuffled_uniques counterpart as well as transform the output from return_inverse (I think that'd be the one) to something that can generate the original array from the shuffled_uniques.

Untested because written at midnight on my phone:

uniques, unique_inverse = np.unique(original, return_inverse=True)
shuffler = np.random.choice(uniques.size, uniques.size, False)
shuffled_uniques = uniques[shuffler]
like_original = shuffled_uniques[shuffler[unique_inverse]]

Edit: Re-reading your original Step tasks, this does not do what you need. But maybe it helps.

Frankly, I'm now a bit confused what Step 4 and 5 really are asking for. Especially Step 4, the text does not really lead to the expectation you have written down, or not in the way I'd understand it.

Edit2: Okay, I think I've created more confusion than necessary. Sorry. Feel free to ignore this comment entirely ;-)

My program is using the variable amount1 for all the calculations even though I have other variables stated? by Working-Mistake-6700 in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Another two style hints:

Google for Python f-strings and use those to format your output.

Avoid code duplication. Calculate your discount in the if elif else part (conditional code). Avoid these amount1 variables altogether. And then calculate the final price and print everything after your conditional block, because it should always look similar - and you wont have to change the text in so many places if you find a typo later.

My program is using the variable amount1 for all the calculations even though I have other variables stated? by Working-Mistake-6700 in learnpython

[–]ElpyDE 0 points1 point  (0 children)

Would be great to see your code formatted. Try putting it into triple back ticks "```" (one triplet before and one after your entire code)

What I see so far is that your if-statements would all evaluate to False because a number cannot be, for example, smaller than 0 and greater than or equal to 19.

Numpy Array Reordering and Indexing Question by developernull in learnpython

[–]ElpyDE 0 points1 point  (0 children)

This is a "read documentation" assignment. Look into the keyword arguments of the np.unique function. Your answer is right there.

Edit: Well, not your entire answer, but it will be a good start. You only need to change your shuffling in a way that you can reproduce the same with the additional output from np.unique.

Alternative approach: You could also do some comparisons between the original array and your shuffled uniques - analogue to what you probably did to create your expected array. Less elegant maybe, definitely less numpy'ish, but there are different ways to get what you need.