Skip to main content

Questions tagged [python]

Code using the python language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 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
1 answer
7 views

PT SET 4: Frank, Ian and Glen’s Letters ....still having issues with functions and Figlet.setFont() missing 1 required positional argument

I am working on the "Frank, Ian and Glen’s Letters". I have issues in my code, relating to the way I am using functions and also to the way I am using Figlet. I would be glad to have some ...
Elvino Michel's user avatar
0 votes
2 answers
23 views

Outdated problem cs50 python

This program is supposed to take as in put dates in two formats: "month/day/year" and "Month day, Year". When I enter dates in the form "September 8, 2024" the program ...
Grace 's user avatar
  • 27
0 votes
1 answer
8 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
0 votes
1 answer
16 views

week 1 meal time: don't know where my error is

I have coded a solution for CS50's meal time from problem set 1. I can't seem to find my errors, as they don't show, but I feel like I've checked that all my floats are converted, so I'm unsure where ...
Lucas's user avatar
  • 1
-1 votes
1 answer
8 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
13 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
  • 23
-1 votes
0 answers
9 views

Problem Set 6 CS50P-Shirt

Trouble with Imageops.fit() Please Ignore formatting mistakes i have never used Stack import sys from PIL import Image, ImageOps import os image_path = sys.argv[1] shirt_path = "Shirt.png" ...
Forklift Certified's user avatar
0 votes
1 answer
15 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
  • 23
0 votes
0 answers
13 views

Why is the database in the instance directory with flaks

I'll add the code below but with help from CS50.ai i've tried to expand the helloflask to add a database. It says it should create color.db in the same directory as app.py is, but it creates a ...
Paul Hamoen's user avatar
-1 votes
2 answers
35 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
0 votes
1 answer
57 views

PSet 4 - Emoji Problem Issue

I have been working on this question for some time now, and really got stuck with few input values, and I am unable to understand the actual error/solve the error. Question: In a file called emojize....
Satyam Lal's user avatar
1 vote
2 answers
36 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
1 answer
27 views

grocery list problem, can the test code commit an error?

Here is my program for the grocery_list problemin python cs50. Something I don'tg understand, the test code indicates the last inputs (sweet potato and tortilla) are not outputed in the right order, ...
Grace 's user avatar
  • 27
0 votes
1 answer
45 views

Problem with Updated CS50 Finance - all API calls to lookup stocks come back as None

I'm a high school teacher and have been teaching CS50 AP for about 7 years now. I like to make sure that I have a handle on all of the problem sets before going over them with my students. So, when I ...
Brian Smith's user avatar
0 votes
1 answer
45 views

Minesweeper - :( add_knowledge cannot infer safe cells when given new information

I'm implementing Minesweeper AI add_knowledge funcion which I expanded with add_sentence function for recursion in inference. I've written tests to test my add_knowledge function and it seems to be ...
Maciej Zamojski's user avatar
1 vote
1 answer
13 views

submit50 not yielding results CS50AI : no results

Everything was working well on my system and I was able to submit the first exercise on week 0 and get some results back, however on the second exercise, tictactoe, submit50 yields no results(I have ...
melbel's user avatar
  • 21
1 vote
2 answers
52 views

Fundamental issue to understand functions with python ===> Impact on all problems

I feel that this is a wrong question to ask because it is simply to wide, and as per my understanding, questions should always be very concise and precise. But I have a lingering issue on the notion ...
Elvino Michel's user avatar
0 votes
0 answers
49 views

PSet 9 check not working

Evening, I am getting the following error trying to run check on PSet9. I have downloaded a new empty version tested that and get the same error. I'm thinking this is a fault on the CS50 side but if ...
faarn's user avatar
  • 13
0 votes
2 answers
102 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
32 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
88 views

PSet 9 Sell handles valid sale expected to find "56.00" in page

Like others I have become stuck with the above error, although the site seems to display the correct info, any help would be appreciated: Python Flask Code: @app.route("/") @login_required ...
faarn's user avatar
  • 13
0 votes
2 answers
27 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
0 answers
33 views

cs50 dna pset 6 - i dont get why my code always return no match

this is my code. whenever i run this code it always returns no match. i cant seem to get the error. pls help me. import csv import sys def main(): # TODO: Check for command-line usage if ...
dhan8293's user avatar
0 votes
2 answers
55 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
31 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
67 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
0 answers
8 views

Problem in World Cup lab 6 with the variable N?

for some reason when i increase the no of N my code just doesn't work and check50 returns errors in men's world cup and women's world cup. Pls help me # Simulate a sports tournament import csv import ...
dhan8293's user avatar
0 votes
1 answer
52 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
0 answers
44 views

CS50p - PSet4 - Adieu - Exit code 1

So, I have supposedly finished my code for the Adieu exercise from Problem Set 4. I tested all of the inputs that check50 uses and I get the right feedback from my code. However, when I run check50 it ...
PquePC's user avatar
  • 1
0 votes
1 answer
266 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
70 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
28 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
1 vote
2 answers
60 views

Week 9 - Finance - Foreign Key Mismatch

I'm trying to solve this issue for a week and nothing works! in my /buy route, I cannot update the users table with updated cash after a "buy" order is submitted. Here is an example of what ...
Julia 's user avatar
  • 21
1 vote
1 answer
270 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
156 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
90 views

:( np_chunk finds noun phrases that don't contain other noun phrases

check50 keep showing that there is a problem even though when I checked it with all 10 sentences it work. It expected the outcome: {'holmes', 'the home'} but my output shows: {'the armchair in the ...
ATLAS's user avatar
  • 1
0 votes
1 answer
58 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
150 views

CS50AI - Parser :( np_chunk finds noun phrases that don't contain other noun phrases

check50 keeps showing that there's a problem with my code ":( np_chunk finds noun phrases that don't contain other noun phrases", but I can't see what I am doing wrong. Please help me check ...
Eva Chen's user avatar
-1 votes
1 answer
62 views

I can not get Check50 to pass "buy handles valid purchase ..." for pset9 finance

Sorry for the messy code. I have been debugging for a few days now. Duck say everything is OK but it will not pass. All the math works out Cash is displayed on the main page under the stock buys. No ...
user41019's user avatar
-1 votes
1 answer
72 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
48 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
13 views

Testing my code on files I created works. CS50 check gives a fail. It seems to make my code count 2 more when comments are checked

import sys def main(): checkfile = check(sys.argv) try: with open(checkfile , "r") as fl: list_lines = fl.readlines() except FileNotFoundError : sys....
Ingrid 's user avatar
0 votes
1 answer
68 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
99 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
0 votes
1 answer
77 views

pset 9 finance :( sell page has all required elements

i searched around for this type of error and looked at my code, but was not able to figure it out. I had something very similar when debugging the buy function and used a similar process for the sell ...
Xenoshell's user avatar
1 vote
1 answer
201 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
120 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
194 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 votes
1 answer
28 views

sqlite optional error message when inserting users input inti db

When I run flask, I get the following error meassage: sqlite3.OptionalError: near "years": syntax error the error mesasge is placed in "cursor.execute(query1)" However, I do not ...
user40089's user avatar

1
2 3 4 5
9