#๐Ÿ”’ 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)

fringe solsticeBOT
#

@last sky

Python help channel opened

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.

last sky
dull fern
#

looks kinda like merge sort but it seems to do only one merge? doesn't look like it'd work

last sky
#

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.

dull fern
#

yeah looks like merge sort

#

curious why you decided to change the names around

last sky
#

im not proficient in python btw haha, still fairly new

dull fern
#

the function names are different in the two samples you sent

last sky
#

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

dull fern
#

yeah chatgpt isn't supposed to be used for this type of stuff (in my personal opinion)

last sky
#

my solution was to ask a real person on here instead

#

could you help me with one more thing please?

dull fern
#

hihi whats up

last sky
#

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

dull fern
#

i'm not very good at algs i can not help you there

last sky
#

ooof unfortunate, i'll just wait for help

#

thanks btw ๐Ÿ™‚

clever current
#

you cannot just use the built in sort?

#

seems weird for a task like that

last sky
#

yes i know

#

i cannot

#

we must implement everything on our own, without using any libraries or any built-in methods, etc

dull fern
#

i mean if "built-in methods" includes lists and dicts you're done for

#

THOSE ARENT METHODS ignore me

last sky
#

we are allowed to use it

clever current
#

what?

last sky
#

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 ๐Ÿคฃ

dull fern
#

hahahaha

#

!doc numpy.sort

fringe solsticeBOT
#

numpy.sort(a, axis=-1, kind=None, order=None, *, stable=None)```
Return a sorted copy of an array.
dull fern
#

problem solved

last sky
#

its weird ik

#

i just need to get rid of copy()

dull fern
#

!doc numpy.copy

fringe solsticeBOT
#

numpy.copy(a, order='K', subok=False)```
Return an array copy of the given object.
dull fern
#

create a new list copy each element one-by-one?

fringe solsticeBOT
#
Python help channel closed

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.