Questions tagged [cs50p]
Questions about CS50's Introduction to Programming with Python.
41 questions with no upvoted or accepted answers
1
vote
0
answers
632
views
CS50 python problem set 6 scourgify - create a csv file with exit code 1
I don't understand why my code fails when I run check50. When I run the code, it produces the expected results. However, when I run check50 I get this error message: Why?
:( scourgify.py creates new ...
1
vote
0
answers
117
views
CS50P Error in pset2 (Coke Machine)
I'm done with my coke machine assignment but now I'm trying to run here in codespace but getting this error, so how am I supposed to fix this?
$ python3 coke.py
python3: can't open file '/workspaces/...
1
vote
1
answer
386
views
I am facing a problem with my final project CS50P
so I am facing a problem with my final project I get 16%.
I check my codes many times (project.py & test_project) everything is working.
I don't know what I miss or what is wrong .!!!
(
My file ...
1
vote
1
answer
493
views
ImageOps.fit not Resizing Properly
In PSet 6 for CS50x Python, we are tasked with resizing a shirt to fit on the wearer. My code successfully changes the size of the shirt per the instructions, but the end result is slightly off from ...
0
votes
0
answers
6
views
CS50P - Seasons of Love output issues
I am unable to fix this error while running the program, kindly find the error S
0
votes
2
answers
15
views
Doing Cs50p Psets 3 Outdated Why is the date when in numbers only outputs 2000-30-20 instead of 2000-03-02
I am doing the CS50P and am doing the outdated exercise. This is the exercise: https://cs50.harvard.edu/python/2022/psets/3/outdated/
My code does everything perfectly, except it outputs single digit ...
0
votes
0
answers
9
views
For the CS50P final project, do the unit tests have to be on the functions at the same indentation level as main?
I Know for the final project of CS50P that you have to have a minimum of 3 functions at the same indentation level as main and then you also have to do unit tests on minimum 3 functions. However, ...
0
votes
1
answer
13
views
Issue printing dictionary in CS50P Pset 3 Grocery
Working on Pset3 "Grocery" problem. At the end of the problem I am supposed to print out the dictionary (my grocery list) with both keys and values. However, when I print, it just shows the ...
0
votes
0
answers
40
views
pset8 cookie jar failing tests for unknow reason
Jar.py:
class Jar:
def init(self, capacity=0):
if not isinstance(capacity, int) or capacity < 0:
raise ValueError("Capacity must be a non-negative integer")
self._capacity = capacity
self....
0
votes
0
answers
23
views
What to do with CS50 codespace after finishing?
I just finished CS50p, I haven't enrolled in the course, but have just been following the course via the website/youtube solving all the problem sets etc. Now I would like to tackle some of my own '...
0
votes
1
answer
11
views
CS50 python mealtime problem Error
I'm solving cs50 python week 1 'meal' problem. I got a error "convert successfully returns decimal hours expected "7.5", not 'Error\n'" and another one is "can't check until a ...
0
votes
1
answer
75
views
Check 50 insists test with pytest is exiting with code 2, in pset 5 for intro to python, how do I fix this?
it's my first post and I have no idea what I'm doing, so go easy. I'm having issues with the first problem in pset 5 of intro to python, testing my twttr. Basically I made some very basic unit tests ...
0
votes
0
answers
68
views
Why is my cs50p codespace not loading- it takes to long!
I'm currently trying to load my cs50p codespace on my mobile phone but it loads really slow and doesn't load all features
0
votes
0
answers
16
views
What could be a pytest file for this program?
I have written this program as my final project. How would I write a pytest file to assure the program is properly tested. It really confused me since the functions I implemented in the program do NOT ...
0
votes
0
answers
41
views
Cs50 Final Project
I currently finished all Weeks and have the final project left. I am planning to start with it very soon, I have two questions :-
Will i be able to redo the project if I get a grade that is less than ...
0
votes
1
answer
75
views
CS50P problem set 1 Meal Time unknown error
I made a solution for problemset 1, Meal Time from CS50P and I can't get a check from check50. The code works for me if I input the code myself but when I run check50 I get the error:
I found the ...
0
votes
0
answers
126
views
Pset 9 Finance: expected to find ¨112.00¨in page, but it wasn´t found
I have been tinkering around with Pset 9 Finance for a few days now, but somehow I am unable to pass check50 even when my website looks the same and works correctly.
Whys is check50 giving the error : ...
0
votes
0
answers
93
views
Problem with CS5 Problem Set 1 - Meal Time
enter image description here
I can get the right out put when I enter the example input, but I can not get the code to pass the cs50 test. Can someone please help me with this?
def main():
...
0
votes
2
answers
32
views
The code allways prompt to enter a new date when entering the date. How to correct my code in order to have the right answer?
import re
months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August&...
0
votes
1
answer
47
views
problems with little professor not rejecting inputs that check50 says it should
When I run locally the program behaves as I think it should. But when I run it through check50 it fails saying that I dont reject inputs that I should reject.
import random
def main():
while True:...
0
votes
1
answer
251
views
game.py rejects out-of-range level expected program to reject input, but it did not!
Here's my code:
while True:
try :
level = int(input("Level: "))
# guess = int(input("Guess: "))
except ValueError:
pass
...
0
votes
1
answer
531
views
cs50 Problem set 2: camelCase
I'm trying to make the "camelCase" problem but i'm stuck. I don't understand how to print a _ when there is a uppercase letter in the input. Could you give me some tips? This is the code ...
0
votes
1
answer
203
views
Refueling - problem set 5 - CS50
I have a problem with refueling from problem set 5 of cs50p. I tried and implement a lot of version of the code, always good enough to do the job and pass the test but check50 fails. I give fuel.py ...
0
votes
0
answers
159
views
bitcoin excersise problem set 4
the code works in my pc but check50 find this error and I don't understand why:
Traceback (most recent call last):
File "/tmp/tmptndsrole/test_two_coins/testing.py", line 28, in
bitcoin....
0
votes
1
answer
65
views
Problem Set 4 Little Professor ,expected output doesn't show
I'm solving this problem enter link description here
My code doesn't pass automated test
enter link description here
import sys
import random
def main():
get_level()
def get_level():
while ...
0
votes
1
answer
1k
views
Help with CS50P Pset5 test_plates
I am now in the pset5 in CS50P in the text_plates exercise besides my plates.py code being correct (I have already did check50 in it), and in pytest all tests were passed, when I do check50 they say:
&...
0
votes
1
answer
36
views
No rule to make target distance
distance/ $ make distance
make: *** No rule to make target 'distance'. Stop.
distance/ $ code distance.py
distance/ $ make distance
make: *** No rule to make target 'distance'. Stop.
distance/ $
...
0
votes
1
answer
471
views
cs50p assignment 1... extensions
in extensions.py all of my check50 works except for 😦 input of myfile, with no extension, yields output of application/octet-stream
expected "application/oc...", not "".
at the ...
0
votes
1
answer
117
views
CS50P PSet 6 check50 problem for scourgify
I managed to write the code to make the csv specific, yet the last two checks for check50 are still coming as errors. Here is my code:
import csv
import sys
students = []
if len(sys.argv) < 3:
...
0
votes
2
answers
398
views
CS50P - Seasons of Love
I am having trouble figuring out this pset. Every time, I use check50 it shows many red faces.
from datetime import date
import sys
import re
# pip imported library to convert numbers into word format
...
0
votes
1
answer
311
views
What is the meaning of ”can't check until a frown turns upside down“?
This is my code for the CS50 week 1 homework called Meal time and it can work correctlt.
def convert(time):
y,z = time.split(":")
y=float(y)
z=float(z)
time=y+z/60
return(time)
def main():
...
0
votes
1
answer
3k
views
How to fix cs50p unit testing error (testing twttr)
Hey just add test functions with the error named given and add some tests in it
Errors:
:) correct twttr.py passes all test_twttr checks
:) test_twttr catches twttr.py without vowel replacement
:) ...
0
votes
0
answers
245
views
outdated cs50p problem set error
months= ["January", "February", "March", "April",
"May", "June", "July", "August",
"September&...
0
votes
1
answer
110
views
CS50P - One check keep failing in PSET2
def main():
user_input = input("Input: ")
print(f"Output: {twttr(user_input)}")
def twttr(user_input):
vowels = ["a", "e", "i", "o&...
0
votes
1
answer
443
views
Check50 cannot find target file
MXLinux 21. Latest updates on a state of the art intel machine. Everything else works without problems so far.
I am not always able to check50 or submit50. I have been unable to predict which set of ...
0
votes
1
answer
251
views
CS50P - Week 8 - Object Oriented Programming - Problem faced with try-except block
I am currently on Week 8 Object Oriented Programming of CS50P
This is with regards to an example given during the lecture at about 1:58:40, where we are suppose to use Try-Except to handle the ...
-1
votes
2
answers
18
views
TypeError in "Taqueria" Pset3
I'm working on Felipe's Taqueria in Pset 3. Here is my code:
# Set initial cost of order to $0
order = 0
# Put menu in dict
menu = {
"Baja Taco": 4.25,
"Burrito": 7.50,
...
-1
votes
1
answer
11
views
How do you simultaneously take care of two types of user_input in python?
Greeting everyone,
I am doing CS50P course and stuck on week 3 last question titled "outdated".
problem statement:
n the United States, dates are typically formatted in month-day-year order (...
-1
votes
2
answers
46
views
Little Professor CHECK50 errors can't pass tests
Here's the check50 terminal message:
:) Little Professor rejects level of 0
:) Little Professor rejects level of 4
:) Little Professor rejects level of "one"
:) Little Professor accepts ...
-1
votes
1
answer
337
views
CS50P PSet5 Refueling
:( correct fuel.py passes all test_fuel checks expected exit code 0, not 1
when testing my code, which then prevents the following tests from running
Here is my code for fuel.py:
def main():
...
-1
votes
1
answer
279
views
CS50P Pset4: game.py passes manual check but not Check50
For some reason, on game.py (CS50 pset4) check50 tells me that guesses out of range and non-numeric do not get rejected, even though I try it manually and they do. To add insult to injury, I am using ...