CS50 SEVEN DAY AVERAGE - PRACTICE PROBLEMS WEEK 6 | SOLUTION

preview_player
Показать описание


––– DISCLAIMER –––

The following videos are for educational purposes only. Cheating or any other activities are highly discouraged!! Using another person’s code breaks the academic honesty guidelines. This solution is for those who have finished the problem sets and want to watch for educational purposes, learning experience, and exploring alternative ways to approach problems and is NOT meant for those actively doing the problem sets. All problem sets presented in this video are owned by Harvard University.

–––
Рекомендации по теме
Комментарии
Автор

Hi! Thanks for the video, however, i would like to point out some lines that come out as "unnecessary" to me, and can be omitted to save a few lines of code.

Line 41: date = row['date']
// You can actually see in the code, the variable date is never actually used for nothing, since we only really need the last 14 days, and the "if len(new_cases[state] >= 14: pop(0)" part of the code really makes us only have the last 14 days available in our code.

Line 52: if state not in new_cases: new_state[state] = [ ]
// This has already been taken care of by line 45: "if state not in previous_cases" statement. So we can also omit this line.

As a final comment, i would like to point out that, to get the same result expected in the problem's "How to Test Your Code" section, we need to convert the final values of avg_recent and p to integers, i like to create two new variables and assign them their values converted to integers with the int() function. That way, the final message looks way cleaner with "46%" instead of "46.00%".

nicolascristal
Автор

Thank you for the walkthrough and the use of how to read the debugger! I have wanted to try and walk through the debugger myself and it is a mess of a jumble. So it has been really helpful to watch you go through the debugger as you go along. Mucho gracias!

edwinchan
Автор

Hi! First of all thanks for your tutorials, they help a lot! One question please while debugging my code i saw, that the code of calculate in minute 11:35 looks different than in 13:55 - why is that so? Or do i understand stgh wrong? Also the identation of the last print statement is one to far, isn`t it? Thanks!

hannahoffmann
Автор

The version at 13:10 of Caculator is wrong, I think. It just literally record daily cases, not new_cases, So, itreturns previous_cases dictionary, not new_cases dictionary. Even when you scroll down values in "new_cases" when debugging, it is daily cases.

khoinguyen
Автор

I'm looping 9:09 to listen to the "bop bop the bop" for a concerning amount of time now

julioCesar-lbun
Автор

this is very confusing! between 12:37 and 13:08 the code in calculate changed. this is not shown or explained in the video

Rabazziii
Автор

I mean this in a constructive way: I respect the amount of effort that goes into these videos but you could be a lot better at teaching.

All you do is show the solution. But you don't explain WHY that is the solution. To help the viewer understand WHY every step in this video works would be much more valuable. You can't just show the viewer every step and expect them to understand the underlying concepts without explaining it

nicorepetto
Автор

I hardly assume myself stupid, but how the F can I implement this on my own just by finishing the lecture shorts and kinds of stuff??

taekyukim
Автор

Thank you for including how you debug.

zoeqiu
Автор

To be honest, I didn't understand this not even with the explanation, still thanks for the effort.

MavMoZu
Автор

I can't believe this, you completely changed it without giving any explanation, really embarrassing

ehsanmansouri
Автор

Please DO NOTE THAT if you are getting different figures its fine because the data updates daily

arnaudyembe
Автор

take a rest you're not feeling well honey...

wallygarcia