3,646 questions
-7
votes
0
answers
104
views
Why does it keep promting me? [closed]
When I run this code:
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int counter = 0; // Initialitzate counter
const int increment_every_time = get_int("What number do ...
-3
votes
0
answers
78
views
Check50 failure on pset9, finance (sell) [closed]
I'm stuck on the sell function for the finance problem.
When executing check50 I get this:
:) app.py exists
:) application starts up
:) register page has all required elements
:) registering user ...
0
votes
0
answers
26
views
CS50 Python PSET5 Refueling Pytest Is Passing But Check50 disagrees [duplicate]
So I am doing the [refueling] problem as mentioned above(https://cs50.harvard.edu/python/psets/5/test_fuel/) and my check50 is giving me this output
:) test_fuel.py exist
:( correct fuel.py passes all ...
0
votes
1
answer
102
views
Why does this code get marked as not working? CS50 Plurality [closed]
I'm doing the cs50 basic course task plurality. Now I have the problem that all input I used got the right output, but the cs50 correctness check says otherwise.
Is this because I don't use a sorting ...
1
vote
1
answer
96
views
CS50 Speller Valgrind error: Jump or move depends on uninitialized value(s)
I am currently completing the introductory CS course CS50 only and got stuck on the problem "speller" from problem set 5. In this problem, one is given a set of prewritten .c-files, ...
0
votes
0
answers
223
views
CS50P Problem Set 4, Little Professor displays number of problems incorrectly
I'm running into problems resolving the little professor exercice in CS50P. I tested my program manually and I fail to see what could have gone wrong. The error message suggests that there is a ...
1
vote
1
answer
120
views
C program creates too many JPEG files when recovering images from raw data
I'm working on a program to recover JPEGs from a raw memory card image using C (as part of CS50's "Recover" problem). The idea is to read 512-byte chunks and write each JPEG to a separate ...
0
votes
1
answer
63
views
CS50W Project network, can't figure how to implement the Paginator
I've been trying to implement the paginator function for about two months now. I've tried many different approaches, but they always lead to new bugs.
In views.py, I load the posts and send them to ...
2
votes
1
answer
111
views
CS50 Recover - cannot understand why there's memory leak issue
I'm very very new to programming, and I'm working on the Recover problem set. To create images, I'm using recursion, but there's always a valgrind issue and I can't understand where my code's wrong.
...
1
vote
0
answers
49
views
I'm stuck at cs50's filter problem It blur's image as expected but produces errors in check50
Here's my code from the problem set. The copy_img(), malloc_img(), free_img() functions are for copying image to a temporary image and for memory allocation, freeing allocated memory respectively.
...
0
votes
1
answer
100
views
How do I fix a traceback error in a CS50 Credit Pset in Python?
Been working on a Credit Pset in python. Decided to use regular expressions. Everything was fine before I got to the Lunh's algorithm part. Now I get traceback errors and don't know what to do with ...
-1
votes
1
answer
177
views
cs50's python "bank testing" question is flaging the 4th condition, what is it wanting me to do? Thank you
file to be tested:
'''
def main():
use_input = input("Greeting: ").strip()
x = value(use_input.lower())
print(f"${x}")
def value(greeting):
# if greeting starts ...
1
vote
1
answer
109
views
Working on a CS50 Filter problem. Check50 fails at the "Blur" function
I am working on the Filter problem set for CS50 and run into a problem related to check50 (which is the program that checks my solution for correctness).
"Blur" function calculates the ...
0
votes
1
answer
200
views
How to execute code in CS50 Codespace (correct directory and file)
enter image description hereI am trying to execute my Python code on the command line in the CS50 Codespace IDE. After I enter the command, I get a "can't open file" error message. How to I ...
0
votes
2
answers
87
views
Python IPv4 Validation Only Checking First Byte Instead of All Four Bytes
I'm writing a Python function to validate IPv4 addresses. for a Task of CS50 Python. My function should:
Ensure the format is X.X.X.X, where each X is a number between 0-255.
Return True for valid ...
0
votes
0
answers
56
views
CS50p Question "Outdated" Check failure for one scenario
I just completed the Problem "Outdated" in QuestionSet 3 of Harvard Python CS50p 2022 version.
using Check50 v3.3.11, the automatic check function tried several scenarios and all passed with ...
0
votes
1
answer
63
views
CS50 Filter Problem: Program could not open image file
I'm testing the greyscale function for the filter problem in the Memory problem set. The compiler doesn't seem to have a problem with the code, but when I type in the command (./filter -g yard.bmp out....
1
vote
5
answers
139
views
How do i replace text before a certain point in a string?
Below this is my code, I have a tuple of different possible extensions that the user can use to open a file. But the files that the user will open will have a name (like cat.zip or daughter.jpg). I ...
-3
votes
2
answers
113
views
CS50 Problem Set 3: Why is my code failing check50 for the grocery problem? [closed]
The problem set I am trying to solve: CS50P 2022 psets/3/grocery/
My code:
def main():
lst = []
try:
while True:
lst.append(input().upper())
except EOFError:
...
1
vote
1
answer
121
views
CS50 week 5 inheritance memory leak
I am currently at week 5 of CS50 at inheritance. I have finished the create_family function and free_family function but when I used check50 to check my work but got a memory leak error in my ...
1
vote
1
answer
442
views
CS50P-problem set 7-working 9 to 5-pytest exit code
I don't know why it's showing the exit code for test_working.py is 2. Please see the screenshot for the error message I got from check50:
Both file works well on my end...
I ran "pytest ...
0
votes
2
answers
80
views
Missing one case output for the CS50x Readability assignment , grade 5 output is expect but i get grade 4
LINK TO ASSIGNMENT: https://cs50.harvard.edu/x/2024/psets/2/readability/
heres my code for the CS50x Readability assignment
for an input of "Harry Potter was a highly unusual boy in many ways. ...
1
vote
1
answer
97
views
C: Segmantation fault (core dumped)
While doing the CS50-task recover i finished everything and ran valgrind over it. Valgrind returns a possible segmentation fault, even though I made sure to never access memory, I don't have access to....
0
votes
1
answer
681
views
Error: Codespace Running in Recovery Mode After VS Code Update - 'Rebuild Container' not helping
Description of Issue:
I have been trying to write in VS Code but every time I open it after the recent update, the following error message pops up:
This codespace is currently running in recovery mode ...
1
vote
0
answers
72
views
cs50 filter-more blur passes all test except 4x4 test
Sorry in advance. English is not my first language and this is my first question... Might not follow correct format.
I am trying to solve the CS50 filter-more problem with box blur method. I have to ...
-2
votes
1
answer
76
views
CS50: no output in the terminal [closed]
Right now, i'm on a problem that prompts me to make a program based on license plates in Massachusetts, with a few conditions.
1.“All vanity plates must start with at least two letters.”
2.“… vanity ...
2
votes
2
answers
114
views
How do I delete a pointer after assigning another pointer to that memory in C?
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
typedef struct node
{
int number;
struct node *next;
}node;
// create the pointer to the main ...
0
votes
1
answer
47
views
Memory error in pset5 Speller, says I am trying to access 8 bytes of memory that I do not have access to
I made the speller program from problem set 5 and it does everything right except for some memory error, which I am not able to solve. My code is as follows:
// Implements a dictionary's functionality
...
0
votes
2
answers
765
views
"Testing my twttr" error with check50 - CS50P PSET 5
Goal is to test twttr.py with test_twttr.py
twttr.py:
def main():
user = str(input("Input: "))
print(shorten(user))
def shorten(word):
word = str(word)
result = ''
...
0
votes
0
answers
35
views
valgrind tests failed in speller cs50?
My code failed valgring test.I tried so many times to figure out the error and I gave up.can someone help me to find the error ..
// Implements a dictionary's functionality
#include <ctype.h>
#...
0
votes
1
answer
107
views
When reading data into a sqlite database using a formatted statement, I can generate what looks to be a proper statement, but it won't execute
This is a web application I intend to submit as the final project in the cs50 online programming course, using:
python
sqlite
flask
The goal of the project is to provide on-the-fly grading ...
0
votes
2
answers
112
views
How do I search through a dict using user's input as a key inside a nested dict?
Working on my final project for cs50 Introduction to programming with Python. Trying to implement a programm with a few functions, such as: calculating basal metabolic rate, formatting a list of ...
0
votes
0
answers
70
views
CS50 : Tideman : sort_pairs
sort_pairs is not returning successfully when I check the code. Can anyone help point me in the right direction? I spent quite a while on the previous functions getting them correct as I've been away ...
1
vote
1
answer
78
views
Recovered image does not match : CS50
I am working on the Recover assignment of the CS50 course.
Getting the error : The recovered image does not match (from the CS50 error checker). In other words, I successfully recover 50/50 JPGs, but ...
0
votes
1
answer
118
views
How to count the number of sentences in a given text in C? [closed]
#include <cs50.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
int count_sentences(string text);
int main(void)
{
string text = ...
0
votes
1
answer
341
views
CS50SQL(2024) - PSET 3 - Meteorite Cleaning - New table "meteorites" order by year and name check50 output difference
I am having problems matching the check50 output with my code, even though it properly orders the meteorites by year and name, from my opinion. Moreover, it assigns the IDs starting with 1 from the ...
1
vote
2
answers
112
views
Trouble with CS50 filter-less (blur) code works on an image but only passes 1/5 checks
I have a problem with the function blur in the Filter assignment of CS50.
I've been stuck with the same error messages and wondering if someone can help point out what I'm missing.
Currently the code ...
0
votes
1
answer
85
views
CS50 Tideman :( lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs
Can someone help me understand whats wrong with my code
Im working on this problem set https://cs50.harvard.edu/x/2023/psets/3/tideman/
bool CycleCheckRecursion(int L, int W)
// Checks if there is a ...
0
votes
0
answers
465
views
Selenium / chromedriver problem status code: 127
I'm in the proccess of completing the final project for CS50P and I want to use Selenium to scrape data from web (seems to be called dynamic content, which is why I saw I couldn't use requests). Note: ...
0
votes
1
answer
55
views
My recover file from cs50x pset4 only recovers the corner of the files
I was trying to solve the problem recover of pset 4 of cs50x. We are supposed to create a new image whenever we discover the correct header of a jgp file, which i tried to do so. But for some reason, ...
3
votes
1
answer
154
views
Why is sizeof(HEADER_SIZE) = 4 when it was initialized as 44? [closed]
Given below is my solution to CS50's Week 4: Volume. The problem I was trying to solve was to read a .wav file and change its volume based on a comandline argument 'factor'.
Problem:
When I was ...
-3
votes
1
answer
776
views
How to get the CS50 'Meal Time' exercise to pass tests
def main():
time = input("What time is it? ")
hours, minutes = time.split(":")
minutesToHours = float(minutes) / 60
convert(float(hours)+minutesToHours)
def ...
2
votes
1
answer
79
views
Am I using return render(request, url) wrong in django? (CS50)
In Project 1 of Web Development with Python and Javascript with CS50, I made a form class that should create a new wiki page.
It's supposed to get the input before using its "action" to ...
2
votes
1
answer
76
views
CS 50 - Filter More Edges - all test cases passing (incl. 3x3) but not 4x4
I have written the below code for the Edges function for CS50. I pass all test cases except for the 4x4 image. I can't seem to figure out why my code would work for a 3x3 image but not a 4x4 (or an ...
0
votes
1
answer
73
views
Why is there no output when working with certain card numbers? cs50 credit problem
The program asks the user for a credit card number and then reports (via printf) whether it is a valid American Express, MasterCard, or Visa card number, using luhns algorithm and the requirements for ...
1
vote
1
answer
102
views
Floating point exception (core dumped) error cs50 credit problem
I'm working on cs50 and I'm getting this error when trying to run. The program asks the user for a credit card number and then reports (via printf) whether it is a valid American Express, MasterCard, ...
1
vote
0
answers
322
views
CS50(2024) - Finance. :( registering user succeeds and portfolio page is displayed - expected status code 200, but got 400
I am doing the CS50 course and am struggling to complete Pset9 - finance(2024). When I submit my code, the check 50 displays an error saying ":( registering user succeeds and portfolio page is ...
0
votes
0
answers
72
views
Images at the top are fine but then become completely gray
I have been trying to figure out what is wrong with this piece of code and I swear I have checked other people's code in different posts, and it seems this is logically identical. I am sure there's ...
1
vote
1
answer
88
views
Edge function in cs50 filters pset
I’ve been working on the cs50 filters assignment. All the other ones have had pretty small issues with easy fixes, but this one if completely not working.
This project’s intended purpose is to detect “...
1
vote
0
answers
138
views
lock_pairs and sort_pairs functions, tideman cs50
I’ve been working on tideman (in cs50) and two of my functions have not been working. I thought my project was functioning just fine, but when I ran check50 I got a :( on all the criteria relating to ...