6 votes
Accepted

How to get and download edX CS50 verified certificate?

Each month, we send a list to edX of anyone who qualified for a certificate in the previous month. Once they get the list, about a week later they will generate the certificates, which can be found ...
  • 18.4k
4 votes

any idea how to fix Mario more comfortable problem "expected output"

check50 is expecting the last # on a line to be followed by the newline. It is complaining about the trailing spaces.
4 votes
Accepted

Pset1 error: expected identifier or '('

The body of the main function must go between keys, the compiler interprets that as the keys are missing, declaring a function before main (this will be seen later) the solution is simple: int main(...
  • 5,181
3 votes
Accepted

Pset 4 : recover

It's probably safe to assume the first block is not a jpg sig otherwise what would be the point of the exercise? At the first fread, what happens if it doesn't find a jpg sig? Control goes here ...
2 votes
Accepted

Pset1: ~/workspace/pset1/ not working

The source codes, hello.c and water.c, are in the workspace directory, not workspace/pset1 directory. You can move them to the pset1 directory. At the ~/workspace $ prompt: mv hello.c pset1 mv water....
2 votes
Accepted

Pset1: Water- Infinite Loop

What we want is that the user input, with the get_int function is inside the DO-WHILE loop, we do not want to print the number of bottles inside that loop because if i is positive the end condition of ...
  • 5,181
2 votes
Accepted

Can anyone explain that attendence algoritm of week 0 lecture?

Following would be the steps assuming 8 students are in the room 1. Each of them would have the number 1 in their mind and 8 of them would be standing 2. You add the number in your pair's mind (in ...
  • 36
2 votes
Accepted

PSET5: Segmentation Fault in Speller

In check, what if hashtable[x] is NULL? Your loop should use something like while (current != NULL). Also, use cmpres == 0 (is equal, return true) rather than == 1 (is greater than). strcasecmp ...
  • 20.7k
2 votes
Accepted

Pset6 2017 - 'str' object has no attribute 'isaplha' - caesar.py

Check your spelling! Sometimes it's the simple things ;)
2 votes
Accepted

Can someone please tell me how to use help50 in the CS50 IDE terminal window?

help50 is for explaining error messages, not necessarily for debugging, that's mostly the field of debug50 (in combination with breakpoints in the code editor). Both are put before the command, like ...
  • 20.7k
2 votes

PSET2, crack.c Did this problem fall out of the sky from week 115? Am I overthinking this?

Crack is a 'more comfortable' problem, so it assumes that you have programming experience and that you have a knowledge of arrays, strings, loops, etc. If you don't consider yourself in the 'more ...
  • 18.4k
2 votes
Accepted

Pset8 - mashup (2018 or 2017): Downloading distribution code does not include txt files

You only show the instructions from the spec, not what happened when you ran the commands, so this answer is only speculative. First, I followed the directions and it worked as expected. Some ...
1 vote
Accepted

caesar.c questions

Your problem occurs here: for(int i = 0, n = strlen(plaintext); i <= n; i++) If we look at the first test case, plaintext is a, which has length of 1. Based on your for loop, you will allow keep ...
  • 1,424
1 vote
Accepted

Caesar PSet2: Check50 deems correct looking outputs incorrect

Based on the sandbox link, it looks like you are missing the terminating new line as required by the spec: After outputting ciphertext, you should print a newline. Your program should then exit by ...
1 vote
Accepted

CS50 2017 crack.c not working properly

Your code doesn't wrong actually but your assuming that passwords have four characters only because of this wrong assumption some of hashes doesn't return anything. for example try this hash: ...
1 vote

Give a Function access to earlier value

You should store temporarily the value of height, to a new variable, so that you don't change the original value, like so: void foo(int foo_height); int main(void) { int height = get_int(); ...
  • 7,356
1 vote
Accepted

Give a Function access to earlier value

You have global var height. When you get value from user, assign it to height. Then copy it to new local var height1 which you can change as you want.
  • 1,139
1 vote
Accepted

game of fifteen help

row == d-1 && col == d-1 would be true on the last iteration of both outer (row) and inner (col) loop. At that time, you've checked all but the last tile to be in right order. If those are, ...
  • 20.7k
1 vote

cs50 pset 6 greedy

You have change/25 three times, shouldn't dime and nickel be 10 and 5 instead of 25?
  • 20.7k
1 vote

CS50 : pset4 resize(less comfortable)

The specification says to determine what header fields need to be updated. There are fields in the headers other than biWidth and biHeight that must be modified when n != 1. I don't see any code to ...
  • 64.6k
1 vote

CS50 Pset7: Final Questions before Wrap-Up

I'm no expert, but I thought I'd give it a try since I just finished the problem set myself: Your questions 1 and 2 are related. GET and POST are methods that determine how data is submitted to the ...
  • 13
1 vote
Accepted

CS50 Pset7: Final Questions before Wrap-Up

The button does the action defined in the action attribute of the <form> tag. text is not a valid type for a button (see MDN doc on button and form) but it doesn't fail because, well, browsers ...
1 vote

New users not being entered into database

Well... figured it out. I forgot to hash the new password. So I added... hashed = pwd_context.encrypt(request.form.get("password")) and now it works. Duh.
  • 21
1 vote

PHP removal from CS50

Disclaimer: I am not part of CS50 team, and don't know their reasoning. This is my opinion, why I think that has been a good idea, especially when touching currently trendy topics like "machine ...
  • 20.7k
1 vote
Accepted

I can't view any of the CS50x course material. Pls help me

Are you using an ad blocker? I use firefox w/ABP and no videos would play until it was disabled for edx.org. You can also find the class materials for CS50x 2017 here, the Harvard fall 2016 version.
1 vote
Accepted

Limits of data type as explained in Week-1

The problem is how numbers are stored. A computer operates with a binary or base-2 number system. The real world operates in a base-10 system. The only fractional numbers that can be stored with ...
  • 64.6k
1 vote

Jinja template exception: "jinja2.exceptions.TemplateSyntaxError"

holdings in your python script is a dict. The {% for holding in holdings %} in the jinja template suggests a list of dicts instead. {% holding.total + holding.cash %} is the part crashing your script....
  • 20.7k
1 vote

How to represent current date and time of purchase in table

How about making your time column in your table have a default value of CURRENT_TIMESTAMP so it gets filled in automatically. That way, each time you insert into transactions, the value will be put ...
  • 18.4k
1 vote
Accepted

CS50x2017 Pset7 quoted.html Extracting Dict Items in Template?

Jinja Documentation | Variables You can access the values the same way as in Python: {{ dictionary['key'] }} You can alternatively use dot notation: {{ dictionary.key }}
1 vote
Accepted

Pset6 2017 application.py Sentiments

Yes, in the application.py you need to implement almost the same code as you have written in tweets. load positive.file and negative.file into memory analyze each tweet positive = 0 negative = 0 ...

Only top scored, non community-wiki answers of a minimum length are eligible