Relative Content

Tag Archive for pythoncs50

I’m getting “timed out while waiting for program to exit”

your textimport random
your textdef main():
your textnumber = get_int()
your textnewRandomInt = rand(number)
your textwhile True:
your texttry:
your textguess = int(input(“Guess: “))
your textif guess < 0:
your textcontinue
your textelif guess < newRandomInt:
your textprint(“Too small!”)
your textcontinue
your textelif guess > newRandomInt:
your textprint(“Too large!”)
your textcontinue
your textelif guess == newRandomInt:
your textprint(“Just right!”)
your textbreak
your textelse:
your textbreak
your textexcept ValueError:
your textpass

How is the * wrong?

Im currently learning Python over the cs50p course and i’ve tried to do the problem sets, yet I’ve ran into an Issue. It wont complete the multiplication and I don’t understand why.
Link to the problem set: https://cs50.harvard.edu/python/2022/psets/0/tip/

Unable to enter user input as list in python

I expected that the code would ask me for input as many times as I want and then print out the number of times the input has been entered along with the name, capitalized. However, it only prints out the last input with 1 in front of the input

failing automatic check for CS50’s “Little Professor” problem

I am trying to solve the “Little Professor” problem from CS50P Problem Set 4, but my code is not passing the “check50” automatic code check. I tried to find cases of people having the same problem, but it seems like their code had mistakes that mine doesn’t (like not using range function properly, or calling generate_integer function twice).