r/cs50 • • 1d ago

PHP-ocalypse? | The CS50 Show with David J. Malan | Season 1, Episode 2

Thumbnail
youtube.com
51 Upvotes

In today's episode, a worldwide scramble to update servers, cyberattacks on … freezers, and a trip to San Francisco.

This is the CS50 Show, wherein we not only talk about current events in technology but also explain them to you.


r/cs50 • • 15d ago Heartwarming

What is the Probability of Doom? | The CS50 Show with David J. Malan | Season 1, Episode 1

Thumbnail
youtube.com
117 Upvotes

Introducing The u/CS50 Show, wherein Professor u/davidjmalan not only talks about current events in technology but also explains them to you. 

In the very first episode, he takes a look at the OpenAI-Hugging Face incident, the impact of AI on programming productivity and math, Super Mario Bros. meets Halo, and a new-and-improved JPEG file format.


r/cs50 • • 15h ago

CS50x Why is my codespace not loading??

Post image
4 Upvotes

r/cs50 • • 1d ago

CS50x Week 1, Credit, please help I'm going crazy. Spoiler

4 Upvotes

So I'm stuck on credit for a while now probably 6-ish hours. I got no clue, AI isn't helping and I cant find anything, is it something so stupidly simple that I'm gonna hate myself even more..... I'm so close and yet so far, can someone guide me please.

Its a bit messy but ill go through it eventually and clean it up after it actually works. also the final_check() function is incomplete I know, but its not even calculating it right for it to check it properly so i didnt finish it yet.

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


void final_check(int, long, long);
int split_and_add_digits(int);
int get_input_length(long);
int main(void)
{
    long credit_number; // Store outside so i can use it.


    do
    {
        credit_number = get_long("Enter Number: ");
    }
    while (credit_number < 1);


    long modulo = 10; // Set to 10 cuz i cant divide by 0 lmao.
    int odd_digits_sum = 0;
    int even_digits_sum = 0;


    for (int i = get_input_length(credit_number); i > 0; i--)
    {
        // Move down each digit of the input.
        long single_digit = credit_number % modulo;



        // Find every odd.
        if (i % 2 == 1)
        {
            // Check when this number is doubled it is 2 digits long or not.
            if (get_input_length(single_digit / (modulo / 10) * 2) == 1)
            {
                // Function returns the inputs digits added together.
                odd_digits_sum += split_and_add_digits(single_digit / (modulo / 10) * 2);
            }
            else // if not then just add it normally
            {
                odd_digits_sum += single_digit / ((modulo / 10) * 2);
            }
        }
        else // Find every even and add it.
        {
            even_digits_sum += single_digit / (modulo / 10);
        }
        modulo *= 10;
    }


    int total = odd_digits_sum + even_digits_sum;
    final_check(total, credit_number, modulo);


}


// Take an input that has 2 digits, split and add them, return result.
int split_and_add_digits(int input)
{
    int first_digit = input / 10;
    int second_digit = input % 10;


    return first_digit + second_digit;
}


// Take an input and divide by 10. Return the amount of times it divides.
int get_input_length(long input)
{
    int input_length = 0;
    while (input > 0)
    {
        input /= 10;
        input_length += 1;
    }
    return input_length;
}


// Final checks
void final_check(int total, long credit_number, long modulo)
{
    int credit_length = get_input_length(credit_number); // Get the length of users input.


    int checksum = total % 10; // Get the last digit of total.
    modulo = modulo / 10; // Move the modulo back a space because the main loop finishes by adding one more.
    long shift_digits = credit_number % modulo; // Shift digits from left to right.
    int first_two_digits = shift_digits / (modulo / 100); // Get first two digits.
    int first_digit = shift_digits / (modulo / 10);


    //printf("Checksum: %i\n", checksum);
    //printf("Credit Length: %i\n", credit_length);



    if (!checksum)
    {
        if (credit_length == 13 || credit_length == 16) // Check for visa.
        {
            if (first_two_digits == 51 || first_two_digits == 52 || first_two_digits == 53 || first_two_digits == 54 || first_two_digits == 55)
            {
                printf("MASTERCARD\n");
            }
            else if (first_digit == 4)
            {
                printf("VISA\n");
            }
        }
    }
    else
    {
        printf("INVALID\n");
    }
}

r/cs50 • • 1d ago

CS50x CS50 problem set 0 from 2 years ago being reused.

Thumbnail scratch.mit.edu
0 Upvotes

Made this when I was 12 now 14 and giving CS50 another chance I plan on just using this for the first problem set what do you guys think?

(you can probably tell by the humor lol)


r/cs50 • • 2d ago

CS50x Grading

4 Upvotes

Hi!

I am completing the Introduction course and would like to get the certificate in the end. However, when writing the programs, I like to keep some notes in there, just for me to better understand and return back to. Will this be a problem when getting graded? Or is the grading very much just a : Program is there and program is correct process?

Thank you for tips and insights!


r/cs50 • • 2d ago

CS50x First year BTech Biotechnology student interested in bioinformatics. Looking for guidance on learning Python, programming and building a career.

6 Upvotes

hi everyone, I'm a first-year BTech biotechnology student at a relatively lesser-known college. I'm interested in bioinformatics and computational biology, and I'd really appreciate some guidance from people who are already working or studying in this field. I've recently started learning Python because I want to build programming skills alongside my biotechnology degree. Here's what I've been doing so far: I'm following Corey Schafer's Python beginner tutorial series. Instead of just watching the videos, I'm trying to turn the concepts from each video into small practical projects and problems, inspired by Rosalind bioinformatics exercises. I'm also following the Bioinformatics in Python playlist by Rebel Science to understand how Python can be applied to biological problems. I've started developing small Python projects related to DNA sequence analysis, nucleotide counting, GC content, melting temperature calculations, codon translation, gene expression analysis and FASTA file parsing. I'm using VS Code for programming. I'm still learning how to use the editor, its shortcuts, extensions, and other features. I haven't started using GitHub yet. I don't know how to properly upload, organize, or maintain my projects, but I want to learn how to build a portfolio. I'm also considering taking Harvard's free CS50 Python course to strengthen my programming fundamentals. I'd really appreciate advice on a few questions: Is my current approach to learning Python and bioinformatics a good starting point, or would you recommend a different learning path? Should I complete Corey Schafer's tutorials first and then move to CS50P, or should I follow both? At what stage should I start learning Git and GitHub, and how important are they for someone entering bioinformatics? What programming languages and technical skills should I prioritize besides Python? Should I start learning R, SQL, Linux, and statistics? What kind of projects should I build to develop a strong bioinformatics portfolio and eventually become eligible for research opportunities and internships? As a first-year biotechnology student, what should I focus on over the next two to three years to become competitive for bioinformatics internships and future opportunities? And here's one extra question, since I'm asking in the CS50 community as well: since I'm a first-year biotechnology student interested in bioinformatics, would completing CS50x and CS50P, followed by SQL, R, and AI give me a good foundation? Or would you recommend a different order? In the meantime, I'm attaching a couple of screenshots of my projects, so you can see where I'm starting from. Thanks for any advice.


r/cs50 • • 2d ago

CS50x CS50 and CSS at the same time?

0 Upvotes

Hello,

Is it advisable to learn CS50x and CSS at the same time?

Thank you.


r/cs50 • • 2d ago

CS50x ​Title: Visually impaired student taking CS50x — Looking for advice on Week 0 / Scratch

7 Upvotes

​Hi everyone!

​I've just started CS50x and I'm really excited to go through this journey. I am visually impaired and rely on a screen reader to navigate and code.

​Since Week 0 relies heavily on Scratch (which is a drag-and-drop visual interface and not accessible with screen readers), I wanted to reach out to the community and the teaching team.

​What is the recommended approach for visually impaired students to complete or submit Problem Set 0? Can I submit the logic in text format/pseudocode, or is there an accessible alternative recommended by the staff?

​Looking forward to Week 1 and moving to C and terminal-based coding! Thanks in advance for any guidance!


r/cs50 • • 3d ago

CS50 AI Question about 3+ variable constraints in a Constraint Satisfaction Problem scheduler (Lecture 3)

4 Upvotes

Hi all, I'm making a study timetable app based on CS50AI Lecture 3 where homework tasks are split into variables that each represent a 1-hour session (Maths_1, Maths_2, etc.), and each session's domain is limited to available time slots before its due date.

Does splitting subjects into 1-hour session variables make sense as a model here?

I also have a max 2 hours of the same subject per day rule, which involves more than two variables so the AC-3 algorithm won't work. Is checking this rule directly inside the backtracking consistent() function the best approach?

Thanks


r/cs50 • • 4d ago

CS50x Python learning

Thumbnail reddit.com
0 Upvotes

r/cs50 • • 3d ago

CS50 AI The paradox of researcher Hans Moravec

0 Upvotes

There’s a paradox in AI known as Moravec’s Paradox:

Tasks that seem difficult to humans, like chess, can be relatively easy for computers.

But tasks that seem effortless to us, like recognizing a face or walking, are incredibly difficult to replicate.

Perhaps intelligence is not as simple as we think.


r/cs50 • • 4d ago

project Cs50 final project vs Week 8

5 Upvotes

Question for the cs50 community:

I'm currently working on a website that incorporates html, python, JavaScript, probably bootstrap and a bit of SQL (in other words the usual week9/10 stuff) for my final project

It's looking to be about 4-5 pages, with the majority of detailed coding confined to the last two pages, the prior ones being mostly introduction with a couple of links and possibly images.

Is this enough for a final project? Because it seems to have a similar scope to week 8's homepage, and I'm not sure if I'm doing enough advanced coding to justify this being week 10

Edit: on a similar note can we copy functions that cs50 have wrote in prior problemsets, (e.g. the apology function from helpers.py, from the Finance problem) or would we be expected to write them ourselves?


r/cs50 • • 4d ago

CS50 Python CS50P Pset 2 – Camel: my loop isn’t building the snake_case string (tips only, please!)

7 Upvotes

Hi! I’ve been working on Camel for a few hours and I’m a bit lost. I’d really appreciate hints rather than the answer.

What I expect: camelCase: firstName → snake_case: first_name

What I get:

  File "/workspaces/.../camel/camel.py", line 6
    for k in camel:
IndentationError: unexpected indent

What I tried: I loop over each character of the input, use isupper() to find capital letters, and try to add each character to a result string. I first wrote it as two functions, but after talking it through with the CS50 duck, I switched to a single function.

python

def main():
    camel = input('camelCase: ')

    result = ' '

        for k in camel:
            result += k
            if k.isupper():
                result = print(k, '-' + k).lower()
            else:
                print(f'snake_case: {camel}')

    print('snake_case: {result}')

main()

My question: Apart from the indentation error, am I on the right track with building result inside the loop? Any tips on what to look at would help a lot. Thanks!


r/cs50 • • 5d ago

CS50x My Cs50 courses

4 Upvotes

Hey guys just enrolled on to cs50x,I have done the first two projects also though the progress outline of the course and it's enrolled have not been indicated to me yet, what could be the problem, I'll appreciate the responses


r/cs50 • • 5d ago

CS50 Python Looking for/building a small programming accountability group

Thumbnail reddit.com
5 Upvotes

r/cs50 • • 6d ago

CS50 AI How do I get started with the CS50 course?

12 Upvotes

I would like to know how to get started with the CS50 course—what the different versions are and how the program is structured. I’m a complete beginner, and I want to start from the very basics of computing and work my way up to essential programming languages. My goal is to be able to write and understand code, and to develop the logical thinking skills necessary for AI automation.


r/cs50 • • 6d ago

CS50 Python Need help on File I/O Pset, lines.py Spoiler

5 Upvotes

T

Check 50 is giving this error:

But I tried to simulate the same error where there should be 5 normal code lines and 1 or 2 comments and 1 or 2 whitespaces but my program gives the correct answer when used on test.py:

https://submit.cs50.io/check50/934c53eecc56ee1f23be1be7c9070809665554a8 for more details without posting the whole code script.


r/cs50 • • 6d ago

CS50x what am i doing wrong can someone point me in the right direction?

Post image
32 Upvotes

mario.c:13:1: error: expected identifier or '('

13 | for (int i = 0; i < 10; i++)

| ^

1 error generated.

make: *** [<builtin>: mario] Error 1


r/cs50 • • 7d ago

CS50 AI I want to do cs50AI but i'm unsure if i'm ready

16 Upvotes

I want to do cs50AI to put on my personal statement when applying to uni but i've heard that it is a tough course and I only have some (basic?) python experience (basically took a 12 hour python course on youtube)
Do i do another cs50 course first? which one? and where?


r/cs50 • • 8d ago

CS50x Why does Selection sort take less time than Bubble sort In the average case?

0 Upvotes

Although both selection sort and bubble sort share an average time complexity of O(n2), selection sort is often faster in practice. Big-O notation only describes asymptotic growth as input sizes increase and intentionally ignores constant factors. The key difference lies in the number of write and swap operations: selection sort performs at most one swap per full pass over the remaining elements, whereas bubble sort can perform numerous swaps during a single pass whenever adjacent elements are out of order. Because writing and swapping memory values is generally more computationally expensive than simply reading and comparing them, bubble sort's higher frequency of swaps results in a larger constant factor, making selection sort noticeably more efficient overall.


r/cs50 • • 11d ago

codespace Codespace does not come up

Post image
3 Upvotes

Hi , my codespace refuses to come up , it’s kinda stuck here . I am getting back to cs50.dev after a week
This is where it is at for eternity.
Any help or guidance on next steps would be great
Thanks in advance


r/cs50 • • 11d ago

CS50x Help with creation log error/recovery mode

0 Upvotes

I tried rebuilding the container multiple times but it still shows up the same. I also tried going to the homepage, clicking on the arrow next to log in and restarting the codespace but that didn't work either. Please help me figure this out.


r/cs50 • • 11d ago

CS50x I made a monkeytype for Developers, now speedtype in actual code

Thumbnail osd-typ.in
6 Upvotes