#๐ What does this algorithm do? I assumed it was a merge sort, but now I am having second thoughts.
50 messages ยท Page 1 of 1 (latest)
@last sky
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
looks kinda like merge sort but it seems to do only one merge? doesn't look like it'd work
I only showed the algorithm, there's a bit more to the code. It seems to do the job. But I am just unsure whether it is a merge sort or not :/
Here is the rest of the code:
https://paste.pythondiscord.com/PM3A
It is supposed to read a file, remove all punctauation, make all characters lower case, then merge into descending order, showing words in that file with the most occurences, least, and uniqueness.
sorry wdym?
im not proficient in python btw haha, still fairly new
the function names are different in the two samples you sent
oh lmao
because I was very skeptic, so I decided to ask chatgpt without really giving it the name of the function (in case it figures it out). turns out he kept giving me a new algorithm
idk how, but apparently it was an insertion sort twice, then it chose merge then it kept messing up lmao
yeah chatgpt isn't supposed to be used for this type of stuff (in my personal opinion)
my solution was to ask a real person on here instead
could you help me with one more thing please?
hihi whats up
I'd like to remove the .copy() method from the program
as I am not allowed to use it, idk how to work my way around it
as you may see in the code, I already removed a lot of previous built-in methods like, isspace(), .append(), etc
i'm not very good at algs i can not help you there
yes i know
i cannot
we must implement everything on our own, without using any libraries or any built-in methods, etc
i mean if "built-in methods" includes lists and dicts you're done for
THOSE ARENT METHODS ignore me
but you are using numpy
that was an exception for python
we are allowed to use it
what?
believe me, i am 10x more confused than you
took my 2 weeks to wrap my head around it
im not even sure if this will score marks tbh, just wanna finish it ๐คฃ
numpy.sort(a, axis=-1, kind=None, order=None, *, stable=None)```
Return a sorted copy of an array.
problem solved
!doc numpy.copy
numpy.copy(a, order='K', subok=False)```
Return an array copy of the given object.
create a new list copy each element one-by-one?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.