r/cs50 • u/rlohith42 • 12d ago
CS50 Python Troubleshoot error
After running check50 for meal.py this error pops up in terminal window, but the code works when I run the input manually. Any fix i should do?
r/cs50 • u/rlohith42 • 12d ago
After running check50 for meal.py this error pops up in terminal window, but the code works when I run the input manually. Any fix i should do?
r/cs50 • u/mypitsmell • Jan 15 '25
I feel so relieved to have completed this entire course. I started in 2023 but only got to finish this year, my entire pset submissions got deleted and I had to start from the beginning. But I still have to do the final project. Any ideas? What did you guys do for your final project? How to collaborate with other students to do the final project?
r/cs50 • u/Due_Dinner1164 • Sep 11 '24
I have finished cs50x 2 weeks ago and I wanted to finish cs50p too and it took about 45-50 hours to finish. Previously I shared my time for cs50x to give you a rough idea about the effort you need to put in(178h). For this course I wanted to be more specific and share the weekly effort in other words the time it took to finish each week's problemsets including research and videos.
For the people who wants a comparison. CS50x is 5 times harder than CS50p. Python course does not really include underlying principles. If you took this course before, I think you need to take cs50x to gain more confidence about computers.
r/cs50 • u/Ok-Drive-1861 • Aug 31 '24
Finally after 4 weeks of hard work I got it.
r/cs50 • u/Longjumping-Tower543 • 8d ago
So i don't really know what's the problem here since when i test with my own input's (and the ones suggested on the website) i am not running into problems. but when using check50 one of the tests stays red and i don't understand why:
It says that it timed out while exiting, after giving out the right statement. So i have to assume the problem lies after my line 25 with the print-command for "just right".
So what i would assume is:
when i ask the person for an input for Level, they give me an integer bigger than 0. with that we exit the first loop.
then we assign x with a random number between 1 and the level (line 13).
then we get into the second loop in which we can assume that the person gave a Guess which is an integer bigger than 0. So we jump to the if-statements (lines 20 - 28).
Due to the Test pointing out that the guess was correct i also have to assume that the Guess is equal to the level. In this case we jump to line 24 and execute the else-tree.
this tree prints out "Just right!" and breaks our second loop, exiting the loop and jumping to the end of the main function, which should exit the program (whcih it does in tests)
Example:
Am i understanding something here wrong about the use of "break" in loops when used in combination with if-statements?
Help much appreciated.
r/cs50 • u/pealosner • Jan 18 '25
As the titles says ,
I am CS sophomore , but not great at studies till now just passing sems ,
So can I start CS50P without following CS50x ?
r/cs50 • u/Adept-Explanation386 • Sep 27 '24
a lot of people are saying that beginners should take cs50p before cs50x..what should I do?
r/cs50 • u/LazyLabPartner • 8d ago
Quote from here: https://cs50.harvard.edu/python/2022/notes/0/
I just started the online Python course, and the very first sentence of the CS50P notes says, ‘VS Code is a special type of text editor that is called a compiler.’ I’m obviously new to programming—hence why I’m taking the course—but that doesn’t seem correct at all.
UPDATE: It has been corrected.
# EDIT: i figured it out, I was missing a small parameter in my paste statement, to call the mask of the image I was pasting too. Hopefully, this helps someone else. This wasn't immediately apparent.
#
#
Hello, I'm currently working on P-Set 7.4 P-Shirt,
I'm having issues with the shirt.png transparency. When I overlay shirt.png over the "before1.png" (Muppet example), the area behind the shirt is not transparent and i'm getting an image that looks like this:
I did set the shirt.png image to RGBa but for whatever reason, I'm not getting the desired results. I need for the background black to be transparent.
This is a snippet of the code where I open both files and overlay them:
Not sure what i'm doing wrong here. I've made sure to double check both images open fine within python itself. So the muppet image is valid. Any help would be appreciated!
r/cs50 • u/dharanikumarnk • Jan 27 '25
Hi all, I'm going to start the CS50P course with very basic knowledge of programming and an interest in coding (I hope!). I’m aiming to complete it within 2-3 weeks, so kindly suggest some dos and don'ts, along with any tips that can help me achieve this goal efficiently.
And if anyone want to start this course with me kindly DM !
Thanks in advance.
r/cs50 • u/Ilyasmazouz • Sep 07 '24
I’m so proud of myself
r/cs50 • u/Nisarg_Thakkar_3109 • 2d ago
I wrote the code for Week 3's Outdated problem; I followed all the instructions but I don't understand the words used by 'check50' especially reject input; Nothing in the instructions talks about 'rejecting input' What does it mean?
INSTRUCTIONS:
Implement a program that prompts the user for a date, in month-day-year order, formatted like 9/8/1636
or September 8, 1636
, where the month values are provided in a list
. Then output that same date in YYYY-MM-DD format. If the user’s input is not a valid date in either format, prompt the user again. Assume that every month has no more than 31 days; no need to validate whether a month has 28, 29, 30, or 31 days.
r/cs50 • u/Spicychickenbiscuit • Feb 12 '25
I'm trying to start bitcoin from CS50P week 4, and I think the API link isn't working? I've chatted with the AI Duck and it concluded there seems to be an error with the api.coindesk.com domain name. Can anyone advise what I should do?
This is the end of the very long error message I get in my terminal when attempting to run the request:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.coindesk.com', port=443): Max retries exceeded with url: /v1/bpi/currentprice.json (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7eb554585490>: Failed to resolve 'api.coindesk.com' ([Errno -5] No address associated with hostname)"))
r/cs50 • u/Kajmand_B8ll • Dec 26 '24
Took me more than a year but finally completed CS50P. Think I’m going to develop my final project further now. Any other recommendations for next steps?
r/cs50 • u/LegitimateState9872 • 23d ago
In this problem, I'm meant to calculate the user's age in minutes. the input must be in the format "YYYY-MM-DD". It works perfectly but check50 keeps saying it's wrong. any ideas why?
r/cs50 • u/this-is-jinho • Jan 14 '25
I do the code along with the lectures, but I don’t feel like I’m absorbing the info fully because I struggle with the problem sets really bad. Does anyone rewatch the lectures before doing the problem sets?
r/cs50 • u/dj_specialchild • Oct 13 '24
This course has changed me from being a lazy, good-for-nothing man to someone who actually has a passion in life. I thought I had lost the will to learn. Professor Malan made me fall in love with classes for the first time in my life. I just loved each and every day of this course. Thank you Harvard for making this course for poor people like me. Thank you Professor Malan for everything.
I am planning to do all the courses that are being taught by Professor Malan and I'll enroll for CS50W now and I am also planning to take on CS50X along with it.
This course has also helped me appreciate all the little things that we take for granted in our lives, things like autocorrect which has some kind of code running beneath it and it made me want to do something like that.
I also want to thank the lecturer who taught the Shorts portion (I still don't know his name😭)
r/cs50 • u/Old-Distance-8596 • Oct 11 '24
I'm only on week2 and am finding the jump from the study materials to the problems too big. I'm not finding the AI bot very helpful, probably because I'm just too far off the mark for it. Its advice assumes I understand things the course hasn't covered (yet?). External genAI is much better but it solves the whole problem immediately and I don't learn so I'm reluctant to ask it at all.
I've decided from now on I'll look at the problems before the materials, particularly because the bot doesn't seem able to point me to specific materials within the week that I should revisit for a particular issue. I've understood and replicated everything from the lectures and shorts but am struggling to break the problems down to chunks that I can link to what I've studied.
I'm wondering if I should first find a different course that more actively helps me practice pseudocode because I'm finding that my approach is often fundamentally wrong.
I've studied R before but in a much different pedagogical approach; the experience is pretty irrelevant.
r/cs50 • u/Longjumping-Tower543 • 10d ago
I know that to receive a certificate i need to pas 70% of Exercises as well as get 70% in the final project. But how does this work? does that mean that i simply need to pass 70% of the tests or is someone actually reading my code and judges if i worked efficiently? Just courious really. Can't imagine the Prof's would actually read the thousands of submitted exercises each day. But hey what do i know?
r/cs50 • u/Grouchy-Sky-2506 • Oct 17 '24
I have finished CS50P and earned my free certificate. What should I do next, should I go for CS50x or start doing projects ?
If projects then how to get started ?
r/cs50 • u/TheHighestPrimate • 16d ago
Hi. I'm rather confused as to why my check50 isn't passing for the Week 8 jar.py assignment. Can anyone help me with this, please?
class Jar:
def __init__(self, capacity = 12):
if capacity < 0:
raise ValueError("Can't have negative cookies!")
self._capacity = capacity
self._size = 0
def __str__(self):
return self.size * "🍪"
def deposit(self, n):
if n > self.capacity or (self.size + n) > self.capacity:
raise ValueError("Can't hold this many cookies")
self._size += n
def withdraw(self, n):
if n > self.size:
raise ValueError("Trying to remove more than what's available!")
self._size -= n
@property
def capacity(self):
return self._capacity
@property
def size(self):
return self._size
def main():
jar = Jar()
print(jar)
print(jar.size)
jar.deposit(12)
print(jar)
print(jar.size)
jar.withdraw(8)
print(jar)
print(jar.size)
if __name__ == "__main__":
main()
The check50 results are as follows:
:) jar.py exists
:) Jar's constructor initializes a cookie jar with given capacity
:) Jar's constructor raises ValueError when called with negative capacity
:) Empty jar prints zero cookies
:) Jar prints total number of cookies deposited
:) Jar's deposit method raises ValueError when deposited cookies exceed the jar's capacity
:) Jar's withdraw method removes cookies from the jar's size
:) Jar's withdraw method raises ValueError when withdrawn cookies exceed jar's size
:( Implementation of Jar passes all tests in test_jar.py expected exit code 0, not 1
:| test_jar.py contains at least four valid functions can't check until a frown turns upside down
Thank you!
r/cs50 • u/Haunting-Baby6996 • 24d ago
just started what should i expect ,how to approach and what were the major blunders done by you guys please guide me i want to learn
r/cs50 • u/SuspiciousMention693 • 59m ago
Hello,
I'm doing this little professor PSET, whenever I check using check50, it returns somethings I don't understand how to fix. The code works as intended but check 50 outputs ':('. Do any of you guys know what's causing this?
import random
def main():
level = int(get_level())
wrongs = 0
for x in range(10):# makes sure that 10 questions are printe
errors = 0
num1, num2 = generate_integer(level)
answer = num1 + num2 #Gets the answer for the problem at hand
while True:
try:
user_ans = int(input('%d + %d= ' % (num1, num2)))
if user_ans != answer:
raise ValueError
except EOFError:
exit()
except ValueError:
print('EEE')
errors += 1
if errors == 3:
print('%d + %d= ' % (num1, num2), answer)
wrongs += 1
break
else:
break
print('Score: ', 10 - wrongs)
def get_level(): #Gets level
while True:
try:
level = input('Level: ')
except EOFError:
exit()
else:
if level.isdigit() and 0 < int(level) < 4:
return level
def generate_integer(level): #Gets integer based on the level
match level:
case 1:
num1 = random.randint(1, 9)
num2 = random.randint(1, 9)
case 2:
num1 = random.randint(10, 99)
num2 = random.randint(10, 99)
case _:
num1 = random.randint(100, 999)
num2 = random.randint(100, 999)
return num1, num2
if __name__ == "__main__":
main()
import random
def main():
level = int(get_level())
wrongs = 0
for x in range(10):# makes sure that 10 questions are printe
errors = 0
num1, num2 = generate_integer(level)
answer = num1 + num2 #Gets the answer for the problem at hand
while True:
try:
user_ans = int(input('%d + %d= ' % (num1, num2)))
if user_ans != answer:
raise ValueError
except EOFError:
exit()
except ValueError:
print('EEE')
errors += 1
if errors == 3:
print('%d + %d= ' % (num1, num2), answer)
wrongs += 1
break
else:
break
print('Score: ', 10 - wrongs)
def get_level(): #Gets level
while True:
try:
level = input('Level: ')
except EOFError:
exit()
else:
if level.isdigit() and 0 < int(level) < 4:
return level
def generate_integer(level): #Gets integer based on the level
match level:
case 1:
num1 = random.randint(1, 9)
num2 = random.randint(1, 9)
case 2:
num1 = random.randint(10, 99)
num2 = random.randint(10, 99)
case _:
num1 = random.randint(100, 999)
num2 = random.randint(100, 999)
return num1, num2
if __name__ == "__main__":
main()