#๐ Help
47 messages ยท Page 1 of 1 (latest)
@timid sequoia
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.
I need help with a code
Remember to:
Ask your Python question, not if you can ask or if there's an expert who can help.
it's not letting me upload the code to ask the question
have you tried the pastebin?
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
what is the error youa re getting?
the question is You will be given a number of t = 100 rounds of tests you need to pass. For every test you will be given an array of integers a_1, ..., a_n.
The cost of a subsegment of the array a is defined as the number of distinct pair of indexes in that subsegment whose elements are equal.
Divide the array into k non-overlapping subsegments with at least one element, such that each element of the array a belongs to exactly one subsegment.
For every test you will have the below values:
1. The number of the array elements n, and the number of subsegments k, where 2 <= n <= 10 ** 5 and 2 <= k <= min(n, 20)
2. The elements of the array a_1, a_2, ..., a_n, where 1 <= a_i <= n
Find the minimum possible cost of these k subsegments.
this error = Error processing data: Unable to allocate 36.3 GiB for an array with shape (69819, 69819) and data type int64 or Killed
I just dont know how to fix that issue
You need to figure out a different approach.
any ideas?
Can you paste the entire error?
single letter variable names are really confusing btw
Error processing data: Unable to allocate 39.3 GiB for an array with shape (72596, 72596) and data type int64
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
~~~~^~~
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
should look something like that
im not getting that traceback error
Test 82/100
72596 14
Error processing data: Unable to allocate 39.3 GiB for an array with shape (72596, 72596) and data type int64
[*] Switching to interactive mode
just through wsl using python3
Remove the error handler and try it
the error handler?
try/except
sorry im very new to python and chatgpt has assisted with most of this code
You should not use ChatGPT.
Especially if you don't know what you're doing.
ChatGPT can and will give you completely unusable code and you wouldn't know it.
hahaha thats why I joined this chat
My advice is to revert to a version before you started using ChatGPT and work your solution from there.
running it with no error handler now
I'm afraid I can't help debug GPT-generated code.
there is no solution just the question and you have to create a code from that
ok
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.
๐ Help