/r/cs50

Photograph via snooOG

Demanding, but definitely doable. Social, but educational. A focused topic, but broadly applicable skills. CS50 is the quintessential Harvard (and Yale!) course.


O hai! This is CS50's subreddit.

CS50 is Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. Anyone may take CS50, even if not a student at Harvard.


Please Read before Posting

Getting the Best from r/cs50


Status Page

cs50.statuspage.io



Filter by Problem Flair (undo)

cashcaesarcreditdnafilterfinancehousesidemariomoviespluralityprojectreadabilityrecoverrunoffscratchspellersubstitutiontidemangames trackweb trackandroid trackiOS track


Filter by Other Flair (undo)

CS50-LawCS50-BusinessCS50-TechnologyCS50-GamesCS50-MobileCS50-Web



This subreddit is night mode compatible

/r/cs50

118,155 Subscribers

2

PSET 5 Speller - Conditional jump or move depends on uninitialized value

Hey there. Until now I have managed to fix and do every assignment by myself, but I've been going around in circles with this one and there is probably something I don't see.

I won't write an essay to bore you all; my problem seems to be simple, but I can't manage to fix it no matter what I try.

The program works; it catches all the misspells and properly shows the counts, as well as free all the space malloc allocated according to valgrind which is the most important.

https://preview.redd.it/hkm8vs5nk1he1.png?width=1490&format=png&auto=webp&s=4b5334ddb2ba6ccfd0861d10112190971a498a6a

However check50 still shows memory problems, more specifically, that a conditional jump is depended on uninitialized values on lines 35 and 41. It definitely has something to do with the char array of the nodes that are keeping the dictionary words.

https://preview.redd.it/0qvwdviij1he1.png?width=1314&format=png&auto=webp&s=d9fa6a7cc18f39f1d5dff0e5313748a9230b7793

The main thing I am wondering is how am I supposed to initialize these words as they are introduced with the load function I have written separately? What's even more confusing is that the array will never not be initialized, since the load function will load the dictionary every single time before we even get to checking the first word from the text.

I'd appreciate if someone could explain and point me into the right direction.

https://preview.redd.it/xnw721f0k1he1.png?width=2400&format=png&auto=webp&s=ade7961416e59e2b23eba03377f37087194418b1

https://preview.redd.it/shl5h1v6k1he1.png?width=930&format=png&auto=webp&s=a6b6d644e7f21d13d901152eff6a9b11ae9219f6

PS. idk how to copy the code to be a part of reddit. When I do it it doesn't work so these pictures will have to do. :D

5 Comments
2025/02/04
03:31 UTC

2

Is there a reason VSC (Visual studio code) is so primitive?

I'm not sure exactly how to put this. But I've been wanting to get back into programming after a loooooong hiatus, so i started doing CS50x in my own time. However when i first began learning all those years ago i learned in visual studio, and I'm SORELY missing things like a simple compile button.

Is there a reason VSC doesn't have such a simple feature and as a newbie is there some reason i should specifically stick to VSC as opposed to upgrading to a higher end IDE?

(Keep in mind I'm just in week one, perhaps these questions will be answered later?)

9 Comments
2025/02/04
02:48 UTC

4

My code is compiling in my Code space but the check50 code is crashing.

this is the webpage that check50 outputs

https://submit.cs50.io/check50/cf505442355024405d968d311c62861f1ecb6295

doesn't check anything it just print's to log a lot of error of lines that are not even in my code, has it happend to someone else?.

https://preview.redd.it/j4i5hoj5h0he1.png?width=1104&format=png&auto=webp&s=3c091be89b98c3036854571f85a8384bc0171f14

https://preview.redd.it/9jbsbssgh0he1.png?width=1514&format=png&auto=webp&s=0c223f2999f8375b6c1126265b8728e745f2a7a4

I just want to let know someone that might want to fix it... but well I guess I will check my code for myself, for the time being.

and well hopefully is actually what I think it is and not my fault.

7 Comments
2025/02/03
23:51 UTC

5

Why does my code works after 'printf' use?

Hello!

I was playing around with my test file (that I use to do some experiments) to see how can I implement my version of speller and, when trying to understand why do we use malloc to create nodes to linked lists and other data structures instead of just a variable and I wrote this code to help me understand:

https://preview.redd.it/a9nbezo520he1.png?width=312&format=png&auto=webp&s=6f68430f821b2fdb673c9642b8584269c66d8c49

https://preview.redd.it/j3oizyo720he1.png?width=224&format=png&auto=webp&s=b7eb447e85fea6f776f521bcdcc8dc48c9450131

This code does not print "HI, WORLD!" as it should:

https://preview.redd.it/hb53thec20he1.png?width=162&format=png&auto=webp&s=ae6fe7d0acd45a7b7d76acc8c8e3ad006f05a737

However, I discovered that after I make a 'printf' call in 'create_node', "HI, WORLD!" just magically appears:

https://preview.redd.it/qhjifmdg20he1.png?width=343&format=png&auto=webp&s=c59323ec19ec63e12fc0c5300fd45c3735e42d9e

https://preview.redd.it/3hr9tdmj20he1.png?width=157&format=png&auto=webp&s=bb46fefced44b40823d874ad508a5542e610f9c6

My questions are:

1. Why making local variables of type 'node' and linking them to an global array does not make them global (i.e. I can't access them in other functions)? Does it has something to do with variables in the stack being deleted after execution of their local function?

2. Why by simply printing the addresses of the nodes, the code prints "HI, WORLD!" as intended?

Thanks in advance.

p.s. For those who are wondering, I know there are more head files than needed to this code, but it's easier to use external functions that way since I use it for testing.

3 Comments
2025/02/03
22:27 UTC

5

How to approach PSETS

In CS50P, do I need to complete the problem set after each lecture, or should I take the test after finishing all the exercises? The problem sets seem harder compared to what is taught in the lectures

3 Comments
2025/02/03
15:10 UTC

0

How to Organize Notes and Code While Learning Full-Stack Development on Udemy?

Hi everyone,

I’m currently learning full-stack development through a Udemy course, and I’m looking for advice on how to better organize my notes, code, and ideas. Here’s where I’m at:

  • What I Know:
  • I’ve learned HTML, CSS, a little JavaScript, and some React basics.
  • I practice coding along with the instructor and try to experiment on my own.
  • My Current Setup:
  • I use Udemy’s built-in notes feature, but I feel it’s not enough.
  • I’ve heard about Notion for organizing notes and ideas, but I find it a bit complicated to set up and use effectively.
  • My Challenges:
  • I’m struggling to organize my notes, code snippets, and ideas in a way that makes sense.
  • I don’t know how to create templates or structure my notes in Notion (or any other tool).
  • I want a system that helps me track my progress, store code, and review what I’ve learned.
  • What I’m Looking For:
  • Advice on the best way to take notes while learning a Udemy course.
  • Tips on how to use Notion (or any other tool) to organize my learning process.
  • Examples of templates or structures for tracking progress, storing code, and writing notes.
  • Any personal experiences or workflows that have worked for you.
  • My Goal:
  • To build a system that helps me stay organized, retain what I learn, and make it easier to review and practice.

If anyone has been in a similar situation or has tips on how to organize learning materials effectively, I’d really appreciate your help! Thanks in advance.

1 Comment
2025/02/03
12:18 UTC

3

Any video/course recommendation for Node.js/PHP/PostgreSQL/React?

I Found out that Django(from what i have seen on job posts) isn't really all that popular, and Node.js, PHP, PostgreSQL are in big demand, so does anyone have a course recommendation for me to learn more about it? (React course if you know any as well) I found on YouTube courses for them, but I felt asking you guys for a recommendation just incase there is a better course about these topic.

1 Comment
2025/02/03
09:57 UTC

1

CS50 pset2 possible error in testing

I am encountering a strange error in my code that I cannot figure out.

In the problem set 2 "substitution" when i run check50 all tests appear correct except this one:

":( encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key

expected "ciphertext: Rq...", not "ciphertext: Rq..."

It's strange because it seems like the expected output is correct so I don't know how to debug this.

This is my code:

#include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>

// get key using CLI
int main(int argc, string argv[])
{
    string key = argv[1];
    // validate the key: check that the key exists
    if (argc != 2)
    {
        printf("Usage: ./substitution KEY\n");
        return 1;
    }
    // validate the key: check that key is long 26
    if (strlen(key) != 26)
    {
        printf("KEY must contain 26 characters. \n");
        return 1;
    }
    // validate key: check that characters are alphabetical
    for (int i = 0; i < 26; i++)
    {
        if (isalpha(key[i]) == 0)
        {
            printf("KEY must contain only letters. \n");
            return 1;
        }
    }
    // make key all caps to make it case insesitive later
    for (int i = 0; i < 26; i++)
    {
        if (islower(key[i]))
        {
            key[i] = key[i] - ('a' - 'A');
        }
    }
    // validate key: check for duplicate char
    for (int i = 0; i < 26; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            if (i != j && key[i] == key[j])
            {
                printf("KEY must not contain repeated characters. \n");
                return 1;
            }
        }
    }


    // prompt user for some text
    string plaintext = get_string("Plaintext: ");
    char ciphertext[26];

    // encipher
    for (int i = 0; i < 26; i++)
    {
        if (isalpha(plaintext[i]))
        {
            if (islower(plaintext[i]))
            {
                int x = plaintext[i] - 'a';
                ciphertext[i] = key[x] + ('a' - 'A');
            }
            else
            {
                int x = plaintext[i] - 'A';
                ciphertext[i] = key[x];
            }
        }
        else
        {
            ciphertext[i] = plaintext[i];
        }
    }

    // print cipher text
    printf("ciphertext: %s\n", ciphertext);
}
1 Comment
2025/02/03
09:15 UTC

1

Having issues with runoff pset3 for functions tabulate and find min

!​!<When I run check50, it says that my code for tabulate is unable to count votes when multiple candidates are eliminated and handle multiple rounds of preferences

void tabulate(void)

{

// TODO

int n = 0;

for (int i = 0; i < voter_count; i++)

{

while (candidates[preferences[i][n]].eliminated == true)

{

n++;

}

candidates[preferences[i][n]].votes++;

}

return;

}

For find_min, check50 says my code is unable to return the minimum number of votes for candidate

int find_min(void)

{

// TODO

// find first candidate not eliminated

int firstcandidate = 0;

while (candidates[firstcandidate].eliminated == true)

{

firstcandidate++;

}

int minvotes = candidates[firstcandidate].votes;

// find min votes

for (int i = firstcandidate + 1; i < candidate_count; i++)

{

while (candidates[i].eliminated == true)

{

i++;

}

if (minvotes > candidates[i].votes )

{

minvotes = candidates[i].votes;

}

}

return minvotes;>!​!<

1 Comment
2025/02/03
07:59 UTC

7

What do you do next?

This may be a question for a different sub but thought I'd ask here first in case others have gone down this route.

I've recently completed CS50x. I came into it as a complete beginner with zero CS o programming experience. I've started CS50P and plan to work through several of the CS50 courses over the next months (AI, web). I don't pretend to think I'll have any employable skills even after that, so out of curiosity, if I want to work towards being employable in some way, what should I do next? I hear there's a lot of great info at freecodecamp. But I'm assuming that realistically, with the current saturation, I would need some type of degree to actually become employable? I'm 40 years old and I've already done the traditional college and graduate school in a completely unrelated field. I'm trying to explore if there's any legitimate online programs I could pursue down the road.

2 Comments
2025/02/02
19:23 UTC

4

Any cs50 program for javascript?

Exclusively for js... Not talking about the Web dev one

If not... What's the best course similar to cs50

3 Comments
2025/02/02
18:21 UTC

155

Finally Done!!! Thank you CS50 team!

15 Comments
2025/02/02
16:45 UTC

1

Help with blur on filter-less

Everything compiles, but it doesn't pass check50 or my testing it. There is too much code for the duck to handle.

// Blur image

void blur(int height, int width, RGBTRIPLE image[height][width])

{

// Create a copy of image

RGBTRIPLE copy[height][width];

for (int i = 0; i < height; i++)

{

for (int j = 0; j < width; j++)

{

copy[i][j] = image[i][j];

for (int k = 0; k < height; k++)

{

for (int l = 0; l < width; l++)

{

// Middle pixels

if (i != 0 && j != 0 && i != height - 1 && j != width - 1)

{

float total_red = copy[i + 1][j + 1].rgbtRed + copy[i + 1][j].rgbtRed +

copy[i + 1][j - 1].rgbtRed + copy[i][j + 1].rgbtRed +

copy[i][j - 1].rgbtRed + copy[i - 1][j - 1].rgbtRed +

copy[i - 1][j].rgbtRed + copy[i - 1][j + 1].rgbtRed;

float total_green =

copy[i + 1][j + 1].rgbtGreen + copy[i + 1][j].rgbtGreen +

copy[i + 1][j - 1].rgbtGreen + copy[i][j + 1].rgbtGreen +

copy[i][j - 1].rgbtGreen + copy[i - 1][j - 1].rgbtGreen +

copy[i - 1][j].rgbtGreen + copy[i - 1][j + 1].rgbtGreen;

float total_blue = copy[i + 1][j + 1].rgbtBlue + copy[i + 1][j].rgbtBlue +

copy[i + 1][j - 1].rgbtBlue + copy[i][j + 1].rgbtBlue +

copy[i][j - 1].rgbtBlue + copy[i - 1][j - 1].rgbtBlue +

copy[i - 1][j].rgbtBlue + copy[i - 1][j + 1].rgbtBlue;

float average_red = total_red / 8;

float average_green = total_green / 8;

float average_blue = total_blue / 8;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Top left

if (i == 0 && j == 0)

{

float total_red = copy[i + 1][j].rgbtRed + copy[i][j + 1].rgbtRed +

copy[i + 1][j - 1].rgbtRed;

float total_blue = copy[i + 1][j].rgbtBlue + copy[i][j + 1].rgbtBlue +

copy[i + 1][j - 1].rgbtBlue;

float total_green = copy[i + 1][j].rgbtGreen + copy[i][j + 1].rgbtGreen +

copy[i + 1][j - 1].rgbtGreen;

float average_red = total_red / 3;

float average_green = total_green / 3;

float average_blue = total_blue / 3;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Top right

if (i == 0 && j == width - 1)

{

float total_red = copy[i][j - 1].rgbtRed + copy[i + 1][j - 1].rgbtRed +

copy[i + 1][j].rgbtRed;

float total_green = copy[i][j - 1].rgbtGreen +

copy[i + 1][j - 1].rgbtGreen + copy[i + 1][j].rgbtGreen;

float total_blue = copy[i][j - 1].rgbtBlue + copy[i + 1][j - 1].rgbtBlue +

copy[i + 1][j].rgbtBlue;

float average_red = total_red / 3;

float average_green = total_green / 3;

float average_blue = total_blue / 3;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Bottom left

if (i == height - 1 && j == 0)

{

float total_red = copy[i + 1][j].rgbtRed + copy[i + 1][j + 1].rgbtRed +

copy[i][j + 1].rgbtRed;

float total_blue = copy[i + 1][j].rgbtBlue + copy[i + 1][j + 1].rgbtBlue +

copy[i][j + 1].rgbtBlue;

float total_green = copy[i + 1][j].rgbtGreen +

copy[i + 1][j + 1].rgbtGreen + copy[i][j + 1].rgbtGreen;

float average_red = total_red / 3;

float average_green = total_green / 3;

float average_blue = total_blue / 3;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Bottom right

if (i == height - 1 && j == width - 1)

{

float total_red = copy[i - 1][j - 1].rgbtRed + copy[i - 1][j].rgbtRed +

copy[i][j - 1].rgbtRed;

float total_green = copy[i - 1][j - 1].rgbtGreen +

copy[i - 1][j].rgbtGreen + copy[i][j - 1].rgbtGreen;

float total_blue = copy[i - 1][j - 1].rgbtBlue + copy[i - 1][j].rgbtBlue +

copy[i][j - 1].rgbtBlue;

float average_red = total_red / 3;

float average_green = total_green / 3;

float average_blue = total_blue / 3;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Top edge

if (i == 0 && j != 0 && j != width - 1)

{

float total_red = copy[i][j - 1].rgbtRed + copy[i][j + 1].rgbtRed +

copy[i + 1][j - 1].rgbtRed + copy[i + 1][j].rgbtRed +

copy[i + 1][j + 1].rgbtRed;

float total_green = copy[i][j - 1].rgbtGreen + copy[i][j + 1].rgbtGreen +

copy[i + 1][j - 1].rgbtGreen +

copy[i + 1][j].rgbtGreen + copy[i + 1][j + 1].rgbtGreen;

float total_blue = copy[i][j - 1].rgbtBlue + copy[i][j + 1].rgbtBlue +

copy[i + 1][j - 1].rgbtBlue + copy[i + 1][j].rgbtBlue +

copy[i + 1][j + 1].rgbtBlue;

float average_red = total_red / 5;

float average_green = total_green / 5;

float average_blue = total_blue / 5;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Left edge

if (i != 0 && i != height - 1 && j == 0)

{

float total_red = copy[i - 1][j].rgbtRed + copy[i - 1][j + 1].rgbtRed +

copy[i][j + 1].rgbtRed + copy[i + 1][j].rgbtRed +

copy[i + 1][j + 1].rgbtRed;

float total_green = copy[i - 1][j].rgbtGreen +

copy[i - 1][j + 1].rgbtGreen +

copy[i][j + 1].rgbtGreen + copy[i + 1][j].rgbtGreen +

copy[i + 1][j + 1].rgbtGreen;

float total_blue = copy[i - 1][j].rgbtBlue + copy[i - 1][j + 1].rgbtBlue +

copy[i][j + 1].rgbtBlue + copy[i + 1][j].rgbtBlue +

copy[i + 1][j + 1].rgbtBlue;

float average_red = total_red / 5;

float average_green = total_green / 5;

float average_blue = total_blue / 5;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Bottom edge

if (i == height - 1 && j != 0 && j != width - 1)

{

float total_red = copy[i - 1][j - 1].rgbtRed + copy[i - 1][j].rgbtRed +

copy[i - 1][j + 1].rgbtRed + copy[i][j - 1].rgbtRed +

copy[i][j + 1].rgbtRed;

float total_green = copy[i - 1][j - 1].rgbtGreen +

copy[i - 1][j].rgbtGreen +

copy[i - 1][j + 1].rgbtGreen +

copy[i][j - 1].rgbtGreen + copy[i][j + 1].rgbtGreen;

float total_blue = copy[i - 1][j - 1].rgbtBlue + copy[i - 1][j].rgbtBlue +

copy[i - 1][j + 1].rgbtBlue + copy[i][j - 1].rgbtBlue +

copy[i][j + 1].rgbtBlue;

float average_red = total_red / 5;

float average_green = total_green / 5;

float average_blue = total_blue / 5;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

// Right edge

if (i != 0 && i != height - 1 && j == width - 1)

{

float total_red = copy[i - 1][j].rgbtRed + copy[i - 1][j - 1].rgbtRed +

copy[i][j - 1].rgbtRed + copy[i + 1][j + 1].rgbtRed +

copy[i + 1][j].rgbtRed;

float total_green = copy[i - 1][j].rgbtGreen +

copy[i - 1][j - 1].rgbtGreen +

copy[i][j - 1].rgbtGreen +

copy[i + 1][j + 1].rgbtGreen + copy[i + 1][j].rgbtGreen;

float total_blue = copy[i - 1][j].rgbtBlue + copy[i - 1][j - 1].rgbtBlue +

copy[i][j - 1].rgbtBlue + copy[i + 1][j + 1].rgbtBlue +

copy[i + 1][j].rgbtBlue;

float average_red = total_red / 5;

float average_green = total_green / 5;

float average_blue = total_blue / 5;

image[i][j].rgbtRed = average_red;

image[i][j].rgbtGreen = average_green;

image[i][j].rgbtBlue = average_blue;

}

}

}

}

}

}

Where am I going wrong?

1 Comment
2025/02/02
16:38 UTC

2

CS50 final project not evaluated

I've submitted my final project for CS50s programming with Python course, and it said it'll be graded within a few minutes. However, its been 2 hours now and nothings changed on my status page, I've not received any emails or comments or intimations anywhere either. Any advice on what my situation is, whom to contact, and where to look? thank you in advance for any help.

https://preview.redd.it/4awzpy64suge1.png?width=1918&format=png&auto=webp&s=0d65a171b8ae83b760d2fed1ea0be732ad7013d6

https://preview.redd.it/mzee8m64suge1.png?width=1288&format=png&auto=webp&s=ae8c56e85236fbf8e55a42c3b3381eedd9156fc7

4 Comments
2025/02/02
14:31 UTC

3

Should I unenroll the course after finishing

So, I finished cs50x last month and got the certified, but the course didn't disappear from edx, should I unenroll?

3 Comments
2025/02/02
14:05 UTC

9

Final Project

I just completed the CS50 course and am now thinking about building a web application. However, since the course didn’t cover a lot of details, I’m a bit confused about the idea and approach. I’d appreciate any guidance on how to proceed!

4 Comments
2025/02/02
11:32 UTC

3 Comments
2025/02/02
08:27 UTC

6

A beginner in trouble

Hello , can anybody tell me how to use vs code on browser ?

5 Comments
2025/02/02
07:47 UTC

4

Github repository backup question

Sometimes the programs that I make in the VSE automatically appear in my Github repository, but other times they don't. I can't think of anything that I'm doing that makes them show up. I've tried doing it manually but that doesn't work either. For example, I was working on Week 4 "Recover" earlier today and a version of that is backed up on Github, but not the final version I just completed. Is there a way to force this over, or set the frequency of backups?

3 Comments
2025/02/02
03:50 UTC

3

Using things to solve problem sets that haven’t yet been covered

POTENTIAL PSET1 SPOILERS ALTHOUGH WON’T INCLUDE ANY CODE

I’ve just started CS50, I’ve done some programming before using Fortran90 and Python while studying Physics at University some time ago, but wanting to learn coding from a more fundamental starting point, as I was just sort of thrown tools that would help in simulations but didn’t really learn basics. I had never covered C and thought it would be a good place to start.

I’ve just completed the harder of the Mario problems from Pset1. I just tried to create an array with conditions for which character to print. I started using if and else conditions, but ran into an error when trying to use 2 if statements one after another. I looked at some documentation to see if you could impose 2 conditions in one statement. I came across using ‘&&’. This did what I wanted and then the code worked fine.

Can we use things from documentation that haven’t been covered so far in the course for a problem set? After completing and getting the correct output I looked for solutions online to see how they compared, and none seem to use this. I just wanted to know before I submit, otherwise I’ll have to start again and do it differently.

Thanks!

2 Comments
2025/02/02
01:02 UTC

1

Issue with tic tac toe minimax function returning None

I am stuck at implementing the minimax function with alpha-beta pruning. This is were I'm at:

tic tac toe file on github

error traceback report file

6 Comments
2025/02/01
23:13 UTC

5

pset 5: Speller question

The instructions not to alter the prototypes of any of the functions. I have an idea to set up my hash table, but it requires changing the node structure a bit. Would this be alright, or should I not touch that either?

5 Comments
2025/02/01
22:11 UTC

4

How to know which assignments were passed after the grades were archived?

https://preview.redd.it/6p4asw08lkge1.png?width=1822&format=png&auto=webp&s=3b8129e47bfb0a988f9cab20125436cbeec853fe

So after the the grades were archived, the page of grades doesn't show which assignments were passt and which are still not, is there a way to know .

and how to know that everything is passed and claim the certificate?

Thank you in advance

2 Comments
2025/02/01
18:23 UTC

6

Can a block have more than one headers?

It is stated that the each jpeg is stored immediately after the previous one, but in the walkthrough video, Brian suggests that each image starts at the beginning of a block. So, I'm a little confused. Someone, help, please.

4 Comments
2025/02/01
18:08 UTC

6

Python module

I really learned a lot from this material. In particular, the regular expression hint. It took some time to understand the syntax for regular expressions, but it was worth it. Using else after a try/except or a for/while loop was new to me and it is very useful.

1 Comment
2025/02/01
15:56 UTC

4

Why are my birthday entries not being removed?

I am trying to do the birthday pset in cs50 and am trying to make a delete function where a name you entered will be deleted from the database. Rest all of my features such as adding and displaying birthdays are working perfectly, except this one. Why would it be?

This is how i take the to be deleted entry from the user:

<h2>Delete a Birthday</h2>                 <form action="/" method="delete">                    

<input type="text" name="deleted" placeholder="Name">                    

<input type="submit" value="Delete birthday">                

</form>

The following is how i try to remove the entry from the database but it does not.

 if request.method == "DELETE":        

name = request.form.get("deleted")        

if not deleted:            

return redirect("/")        

db.execute("DELETE FROM birthdays WHERE name = ?", name)

return redirect("/")

1 Comment
2025/02/01
13:18 UTC

Back To Top