Skip to main content

Questions tagged [cs50p]

Questions about CS50's Introduction to Programming with Python.

Filter by
Sorted by
Tagged with
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
AAQIL AHMED KULLDIK MANEGAR's user avatar
0 votes
1 answer
9 views

Not sure how to throw an custom error for `try:`

For Problem Set 3, I cannot determine how to throw an error if the denominator or a fraction is larger than the numerator (which is not a built-in error in python). How to I define my own, custom ...
Lewkrr's user avatar
  • 101
0 votes
1 answer
14 views

CS50P coke pset.. I tried many ways to fix this but I can't seem to get right , how can i fix this?

Price = 50 def main(): coins = 0 if coins < price: print("Amount Due: ", due_amount(coins)) else: coins >= price print("Change Owned: &...
Dina Mohamed's user avatar
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 ...
SPDS's user avatar
  • 1
1 vote
2 answers
41 views

Python little professor problem set not passing 10 problems check

I am doing the little professor problem set. Here is my code: import random def main(): l = get_level() score = 0 for i in range(10): n1 = generate_integer(l) n2 = ...
Sergei Srednyak's user avatar
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, ...
smithycey's user avatar
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 ...
getsendy's user avatar
-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, ...
getsendy's user avatar
0 votes
2 answers
38 views

outdated : code not rejecting incorrectly formatted inputs

The following two outputs which are about mixed format input like, October/8/1701 and September 8 1636,are not what they should be and i can`t make them work import re months = [ "January&...
enzo's user avatar
  • 17
0 votes
1 answer
20 views

Why my code only removing 'u' ? cs50p pset2

Hi guys im having a problem in twttr.py exercise from cs50 python this is my code: def main(): text = remove_vowel(input("Input: ")) print(text) def remove_vowel(d): vowels = [&...
Tarek -Gamez's user avatar
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....
Rocky Kong's user avatar
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 '...
user42925's user avatar
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 ...
Abhiram H N's user avatar
-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 (...
Swayam Jha's user avatar
1 vote
1 answer
45 views

PSET 7: test_numb3rs.py validation issue

I am not sure how to ensure the below criteria is met keeping validate function intact. Please help me understand what I should be doing here "Modify the validate function in the correct version ...
Athi's user avatar
  • 33
0 votes
1 answer
40 views

PSET 5 Test plates : getting exit code 0 instead of 1

test_plates: from plates import is_valid def test_correct(): assert (is_valid("ASD123")) == True assert (is_valid("ASD")) == True assert (is_valid("AS2")) == ...
Athi's user avatar
  • 33
-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 ...
Roberto Lacowicz's user avatar
1 vote
2 answers
73 views

CS50 python little professor problem

import random def main(): level = get_level("Level: ") correct_count = 0 for _ in range(10): x = generate_integer(level) y = generate_integer(level) ...
subhasis dehury's user avatar
0 votes
2 answers
105 views

Pset 3: Grocery list, the program ends after one item is inputted

I am trying to do the "Grocery" problem, and I have many issues. First, the program exits after the first input. Second, I have an issue with associating the counted item with the list. My ...
Elvino Michel's user avatar
0 votes
2 answers
46 views

PS5: Vanity Plates : Expected exit code 0, not 1 while testing

After using check50 on my test_plates.py file, I get the following error and it doesn't further check anything ( "can't check until a frown turns upside down"): Cause expected exit code 0, ...
theparanormal22's user avatar
0 votes
2 answers
30 views

Felipe's Taqueria: output check problem

This is my code for the Felipe Taqueria's problem and the output is as expected but I am required to output "Total" before the prompt "Enter your order" but I am unable. Someone ...
Grace 's user avatar
  • 27
0 votes
2 answers
62 views

Inifinite loop for outdated problem

I am working on the "outdated" problem. I need to reformat the output given by the user in order to adehere to the ISO format. My code is as follows: months = ["January", "...
Elvino Michel's user avatar
1 vote
1 answer
39 views

Felipe’s Taqueria: "invalid decimal literal" with f string, but ok without f string. Why?

I am still on "Felipe’s Taqueria" problem, and I do not understand why I get the : "invalid decimal literal" error. My code to print the result is as follwos: print(f"$ { &...
Elvino Michel's user avatar
0 votes
2 answers
78 views

CS50x: Issue on problem Felipe´s Taqueria, program keeps asking me for input, without printing price, why?

I am trying to execute the problem "Felipe´s Taqueria", but I am failing to see any price printed as output. Instead the program keeps asking for input. When I input "Taco", the ...
Elvino Michel's user avatar
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 ...
TheOtherJohn's user avatar
0 votes
2 answers
442 views

CS50P Little Professor error expected "9", not "level: 6 + 6 =..."

When doing check50 I get the error ":( Little Professor displays number of problems correct ". I've found this post where the code works but after comparing it with my own code I still can't ...
Yazkis's user avatar
  • 11
-1 votes
1 answer
95 views

pset4 adieu problem set 4

I am having trouble with the check50. On manual check, the code functions exactly as it is suppose to but on check50 I get the following error codes. :) adieu.py exists Log checking that adieu.py ...
Marilyn's user avatar
0 votes
1 answer
32 views

Vanity plates Regex problem

I have this code using regex as follows, but when all my characters are letters it gives out an output of "invalid" whereas it should not: import re def main(): plate = input("...
Grace 's user avatar
  • 27
0 votes
1 answer
109 views

problem set 4, CS50P , Guessing Game ,

running python3 testing.py... sending input 22... sending input 18... checking for output "Too large!"... my code couldn't pass the guessing game test, the test is sending 22 as a number ...
Subhan SA's user avatar
1 vote
1 answer
300 views

Vanity plates Problem

The following code is my code for the vanity plates problem in cs50 introduction to python course. My issue is on the "Punctuation Function". When I enter an input with a punctuation, ...
Grace 's user avatar
  • 27
1 vote
1 answer
167 views

CS50 Vanity plates

I modified my code with respect to the suggestions given in the comments using regex as follows, but when all my characters are letters it gives out an output of "invalid" whereas it should ...
Grace 's user avatar
  • 27
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
Usifo Emmanuel's user avatar
0 votes
1 answer
79 views

"test_fuel catches fuel.py not printing % in gauge expected exit code 1, not 0"

I have passed all of the other check50 requirements except for this one. Here is my code def main(): while True: try: number = input("Fraction: ") if &...
Bryan Tamrin's user avatar
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 ...
Alaa Hamoush's user avatar
-1 votes
1 answer
98 views

the check50 of the test_fuel is not working in cs50p

this code is working just fine through check50 of the main problem set Fuel Gauge and the pytest for this testing code is successful def main(): while True: try: x = input(&...
Fouad Nabil's user avatar
1 vote
1 answer
53 views

Error message Little Professor displays number of problems correct Cause: Did not find "9" in "Level: 6 + 6 =..."

I am currently unable to pinpoint the root cause of the error message at this time. :( Little Professor displays number of problems correct expected "9", not "Level: 6 + 6 =..." ...
Ivan Torres's user avatar
0 votes
1 answer
54 views

I tried a lot of ways but couldn't figure out why this exit code is always 1.(cs50p-Pset5)

It's the test result of my cs50p course of week 5(Back to the Bank). But when I check my code manually, it seems completely fine to me and I think that there is no problem. But the problem is in the ...
Syed Navid Nowroz Twoki's user avatar
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 ...
Alaa Hamoush's user avatar
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 ...
Yazkis's user avatar
  • 11
1 vote
1 answer
127 views

: ( Little Professor displays number of problems correct Cause: Did not find "9" in "Level: 6 + 6 =..."

Everything test worked fine except, Little Professor displays number of problems correct Cause: Did not find "9" in "Level: 6 + 6 =..." def main(): level = get_level() ...
techno adnan's user avatar
1 vote
1 answer
241 views

Little Professor display number of problems correct

Providing the whole code i cant spot what causing this error tried already shifting etc python tutor and rewriting getting back to the same spot. Can you spot whats wrong?? import random def main(): ...
Alkir man's user avatar
0 votes
1 answer
143 views

scourgify.py problem

I wrote this code for scourgify.py :- import sys import csv import os if len(sys.argv) < 3: sys.exit("Too few Command-line argument") elif len(sys.argv) > 3 : sys.exit(...
Alaa Hamoush's user avatar
1 vote
1 answer
223 views

pset9 finance check 50 :( sell handles valid sale

Hi I am working on Cs50 2023/psets/9/finance/ I have looked at this problem and have rewritten the code multiple ways but can't get past this error in the check. I think I have gotten too close to the ...
Leyzer's user avatar
  • 13
1 vote
1 answer
203 views

pizza.py unclear problem when submitting

from tabulate import tabulate import sys import os if len(sys.argv) < 2: sys.exit("Too few Command-line argument") elif len(sys.argv) > 2 : sys.exit("Too many ...
Alaa Hamoush's user avatar
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 : ...
Asaz1el's user avatar
1 vote
1 answer
293 views

test_plates.py problem

What is the problem with my code for testing plates.py? this is the code : def main(): plate = input("Plate: ") if iss_valid(plate): print("Valid") else: ...
Alaa Hamoush's user avatar
0 votes
1 answer
106 views

CS50P Little Professor error

please what is the problem with this code and why is it displaying this particular error? :( Little Professor displays number of problems correct expected "9", not "Level : 6 + 6 ...&...
Alaa Hamoush's user avatar
0 votes
2 answers
444 views

question in CS50P course on lines.py

I have this assignment: "In a file called lines.py, implement a program that expects exactly one command-line argument, the name (or path) of a Python file, and outputs the number of lines of ...
Alaa Hamoush's user avatar
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(): ...
Opie Taylor's user avatar
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&...
Horace's user avatar
  • 1