10
votes
Pset3: Plurality - Weird output!
You should rethink your logic for the print_winners function.
Here's the pseudocode I'd use.
Declare a maxvote int set to 0.
Iterate over the list of candidates
and check the number of votes. If ...
8
votes
cs50p problemset 7 /working.py
This scenario has been described in the CS50 Python ED forum.
When you get this error message:
:( correct working.py passes all test_working checks
expected exit code 0, not 1
It means check50 is ...
7
votes
Accepted
pset6 - caesar - check50 error: "expected exit code 1, not 0"
main in Python no longer has a special meaning, but is a regular function, its name only chosen to conform to conventions based in C.
Try exit(1) instead of return 1.
Relevant python docs: https://...
6
votes
Accepted
pset6 python bleep
Is the problem that you have hardcoded the input file to "banned.txt"?
From the specification:
Accepts as its sole command-line argument the name (or path) of a
dictionary of banned words (i.e., ...
6
votes
Accepted
pset4 filter: blur seems to be working, but check50 reads errors
You overwrite pixels you still need later, for calculating the neighbouring pixels. What looks about right visually is still wrong.
I made another array, wrote my blurred image to that, then later ...
6
votes
Accepted
Check50 and style50 not working: pset1
So apparently markupsafe was upgraded and soft_unicode does not exist in it anymore. I downgraded markupsafe to 2.0.1 and it fixed the issue for me:
pip install markupsafe==2.0.1
5
votes
Accepted
speller works fine but can´t pass check 50
There is a clue in the check50 results. Suspect your testing is on the large dictionary ("it work exactly like the cs50 staff's").
Try the program with the small dictionary. Chances are it will ...
5
votes
Accepted
Why is my lab1 code failing to pass one test in check50?
It's failing the test because you are using a do-while loop which is incrementing n before it checks if year < y. Remember that the reason to use a do-while loop instead of a while loop is that you ...
4
votes
Accepted
pset4 check50 2016.recover recover.c is working correctly?
Yes, you're getting 50 files, but the last file is wrong. While the image looks right, it has a problem. It's 512 bytes too large.
This is a fairly common error. Look closely at what the code does ...
4
votes
Accepted
pset3/find check50 frown helpers.c compiles. expected exit code 0, not 1
find.c and helpers.h cannot be altered. When check50 runs, it uses its own copies, so your alterations are lost. That will cause the compile to fail.
You need to make all of your changes in ...
4
votes
pset1 cash 2022
Looks like you are using the 2022 version of check against the 2021 version of pset1 cash. The 2022 version of the pset has a new function to implement called get_cents. (There may be other ...
3
votes
PSET5: Why is my code working without fully implemented Unload function
Totally awesome that you are asking the question even though it passed check50! Kudos.
Notice this line Usage: speller [dictionary] text in the valgrind report. Speller didn't really run. You called ...
3
votes
Accepted
pset5 speller works, check50 fails, segfault with small dictionary
Think about what's happening. When using the full dictionary, there are words for every letter of the alphabet. Since your hashmax is 32, there's also a really good chance that every possible hash ...
3
votes
Accepted
pset7 finance check50 invalid purchase
One way to test is to add a hard-coded value to lookup (in helpers.py) that has the condition you need.
Near the top, put this:
if symbol == "ABC":
return {"name": "ABC test","price": 14....
3
votes
Accepted
pset7 C$50 finance check50 error expected status code 200, but got 400
This is pointing to a problem with your index.html page. Have you completed your index function? If not, why are you running check50 which should be used as a final check once you've completed the ...
3
votes
Accepted
pset7 finance check50 doesn't detect a valid sale despite portfolio updating correctly
As suggested in a comment, add this to the top of your lookup function in helpers.py
if symbol == "AAAA":
return {"name": "Test A", "price": 28.00, "symbol": "AAAA"}
and then, with a fresh ...
3
votes
Accepted
Pset1: Problem: expected “##\n”, not “ ##\n”
Your own question hides the answer, carefully observe the difference:
"##\n" " ##\n"
There is a space that should not be there, the hashtag must be perfectly aligned to the left. Your program is ...
3
votes
Accepted
check50 not approving my code but it looks like it's working
The good news is: it looks like your ciphering algorithm is working. Yay. The bad news is you missed a important detail in the spec.
Notice the difference between what cs50 is expecting: "ciphertext:...
3
votes
:( Little Professor generates 10 problems before exiting
i used randint instead of randrange to generate unique questions. dunno why it didnt work with randrange.
if level == 1:
num1 = random.randint(0, 9)
num2 = random.randint(0, 9)
...
3
votes
Mario pyramid works, but check50 not buying it
This is a fairly common misinterpretation of the spec. The pyramid should print out so that there are no leading spaces on the last line, no matter how high the pyramid is.
This code prints too many ...
2
votes
Accepted
pset6 How to tackle check50 on .php?name=Alice
The strtok() call here:
char* absolute_path = strtok(req_tar, "?");
will crop req_tar at the ? and make it always be equal to abs_path.
Because of this, the following condition will never be true ...
2
votes
Accepted
Pset 5 - Question on check(), diff, and check50 (and I found it interesting)
The second one is incorrect and it only passes check50 because of the very small dictionaries that check50 uses.
In your original version, you create a pointer that points to the hashtable, and you ...
2
votes
pset 1: credit.c -- Completed with right output but check error?
The gradebook will give the same result as check50, so if you submit that you will get a deduction. Are you missing the '\n' after INVALID by any chance?
2
votes
Accepted
how to check with check50 for 2017 users
http://docs.cs50.net/problems/hello/hello.html#code-check50-code clearly states that the command for calling check50 for hello is
check50 2016.hello hello.c
(assuming you're in the same directory as ...
2
votes
Accepted
Recovering JPEGs fails Check50 CS50 pset4
The program is reading (and writing) 8 bytes at a time. while( fread(buffer, sizeof(buffer), 1, card) == 1). buffer is a pointer, sizeof a pointer is 8. This runs the risk of detecting a jpg that is ...
2
votes
Accepted
Pset 2 - Initials help
This /n is not a new line. From the spec (emphasis added):
Your program should print the user’s initials (i.e., the first letter of each word in their name) with no spaces or periods, followed by a ...
2
votes
Accepted
My program does everything it's supposed to but cannot pass check50
Every year, CS50 changes what check50 is looking for. You are using the 2016 version - you need to change to what the 2017 check50 is looking for, which is this:
~/workspace/pset2/ $ ./caesar 12
...
2
votes
Accepted
STILL baffling check50 fail for speller.c!
On some versions of C, you cannot declare a global variable index if you include <string.h>. Apparently the check50 server has such a version (and the IDE does not). There is a comment about it ...
2
votes
check50 not working on pset3
I had the same problems after running update50. Despite closing and reopening the terminal.
The only solution was to restart the IDE.
2
votes
check50 failed on pset3 game of fifteen
check50 removes your draw function as that is not tested (you can personalize it however you'd like).
Because of this, if you update any global variables in that function, they won't be updated when ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
check50 × 678pset4 × 110
pset2 × 87
pset5 × 80
pset1 × 79
pset3 × 71
recover × 64
pset6 × 56
speller × 49
resize × 40
cs50x × 39
fails-check50-but-works × 39
mario × 35
caesar × 34
finance × 32
vigenere × 29
error × 27
c × 24
greedy × 18
server × 18
parse × 17
pset7 × 15
game-of-fifteen × 14
fifteen × 14
valgrind × 13