6

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 as a link on your Dashboard. So, depending on when in 2017 you completed everything, you should receive the certificate in the month afterwards. If you think ...


4

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


4

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(void) { int n; do { //code } while... }


3

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 fwrite(&chunk,1,512,outptr);. What is outptr? It is NULL. Program cannot write to NULL. It gives seg fault. You'll need to add logic to only write data when you ...


2

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.c pset1 Here's what the file tree will look like, notice the file names are indented under the directory in which they live.


2

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 loop (i> 0) does not Is never fulfilled, and we have an infinite loop. The solution is to ask the user a positive number, that is to say we keep asking for a ...


2

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 this case is 1 in each of their mind and the resultant would be 2) and one of you in your pair sits down. 3. After the pairing, 4 people would be standing with 2 ...


2

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 returns an integer <0, 0, or >0, depending on how the two strings relate to each other, and only 0 means "equal". In load, don't traverse the linked list (O(n)). ...


2

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


2

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 help50 make caesar, or help50 valgrind ./caesar 42, or debug50 ./caesar 42.


2

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 comfortable' group of students, then you will find this to be a challenging problem requiring lots of outside study (you cannot solve this with the materials ...


2

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 possibilities A copy/paste accident? Like mashup.zip downloaded twice instead of mashup.zip and US.zip Wrong directory? US.zip is in another directory, like pset8 ...


1

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 incrementing i while it is less than or equal to 1. However, we have to recall how a string is stored in memory. In the case of a being stored as plaintext, we ...


1

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 returning 0 from main. sandbox left side: Expecting the following on standard out —ciphertext:\s*b\n sandbox right side: ... but received the following on ...


1

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: 50YHuxoCN9Jkc with this modification it returns two character Password which is 'JH' ( this is your code, i just modified to check two characters only as you can see ) ...


1

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(); for (int tmp_height = height; tmp_height >= 0; tmp_height--) { /* code */ } foo(height); } void foo(int foo_height) { /* code */ }


1

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

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, the last one also is. Second version would return true if last empty tile is in the lower right, independent of the order of the other tiles. You could fix the ...


1

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


1

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 deal with them. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


1

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 server. With GET the data is appended to the URL (for example when you search 'cats' on Google, you can see 'cats' in the search results' URL). POST carries the ...


1

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 have to be very (very) forgiving because there is a lot of bad code out there. If you validate your code (type="text") with a code validator (for example Nu Html ...


1

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.


1

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 learning". Both are used by people for command-line scripts and web stuff. There are also a few GUI programmes written in Python, haven't encountered one written in ...


1

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

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 perfect accuracy are those where the denominator is a power of 2, like 1/2, 1/4, 3/4, 5/8, etc. Any other fractional part of a floating point number, i.e., the ...


1

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. Use {{ }} instead of {% %} for those.


1

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 in (and you don't need to explicitly list it in your query).


1

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

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 neutral = 0 score = 0 for tweet in tweets: score = analyzer.analyze(tweet) if score > 0.0: positive += 1 elif score < 0.0: ...


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