Hot answers tagged

2

This is a good question. There is merit to moving on and to finishing everything before moving on. These classes are designed to build on everything that comes before. Moving on before mastering a concept can make learning and applying new concepts more difficult because you're fighting with multiple concepts at the same time. However, banging your head ...


2

You can redirect the output to a file and then open that and go to the bottom. $ cat 1.sql | sqlite3 movies.db > 1.txt alternatively, if you only want the number of rows $ cat 1.sql | sqlite3 movies.db | wc -l The wc -l counts the lines, that would include the header, so you would have to subtract 1 to get the number of data rows.


1

Interesting that check50 doesn't pick that up! There is a problem in find_min. That function should have no side-effects, ie should not change any data, only report a result. This line candidates[j].votes = candidates[i].votes; has the potential to change a candidates vote count; that would be bad. There may be other problems in the code, but this jumps off ...


1

There are several problems. First, the word count is off by 1. Hint: is the code actually reading the end of string marker? Second, and most important, look at the calculations: float L = count_letters / count_words * 100; float S = count_sentences / count_words * 100; Each of the elements in the calculations is an integer. That means that this is integer ...


1

It happens some times. It is still in the substitution directory. If you are not sure then type cd in the terminal and then type cd pset2/substitution in the terminal. If this helps please check the tickmark.


1

credit is a hard one especially if you are not familiar with arrays...i still don`t understand how people do it without arrays...so yeah move on to next week if you finished the comfortable pbset. it took me weeks to get it right ... had to come back to it multiple times ..but you ll get there in the end...


1

I often wouldn't be able to do the uncomfortable question in the problem set and just made sure that I spent as much time as I could trying it until I was losing my sanity. I'd then move on and come back to it a bit later when I had improved a bit.


1

Try this election: 3 candidates: a, b, c and 2 voters who vote for c. It reports a and b as (tied) winners. That's because c's votes are not considered in the first for (int i = 0; i < voter_count; i++), because voter_count is 2 and candidate c is index 2. (Neither is candidate c considered in the second for (int i = 0; i < voter_count; i++), for the ...


1

I haven't yet seen the 2020 ones, so I am not sure if there are any changes in the curriculum. But since the EdX course right now is built on the curriculum from the course of 2019 (PSETs, etc.) I think it would be best to simply follow the videos of 2019. It's perfectly fine to stick to these videos and finish the certificate - CS50 is taught every year, so ...


1

You can also count the number of rows using SELECT COUNT(title) instead of SELECT title in the query.


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