Skip to main content
edited tags
Link
UpAndAdam
  • 1.7k
  • 1
  • 3
  • 20
Changed check
Source Link
:)Results for cs50/problems/2022/python/professor.py exists
Log
checkinggenerated thatby check50 v3.3.11
:) professor.py exists...

:) Little Professor rejects level of 0
Log
running python3 testing.py get_level...
sending input 0...
checking that input was rejected...

:) Little Professor rejects level of 4
Log
running python3 testing.py get_level...
sending input 4...
checking that input was rejected...

:) Little Professor rejects level of "one"
Log
running python3 testing.py get_level...
sending input one...
checking that input was rejected...

:) Little Professor accepts valid level
Log
running python3 testing.py get_level...
sending input 1...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 2...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 3...
checking that program exited with status 0...

:) At Level 1, Little Professor generates addition problems using 0–9
Log
running python3 testing.py main...
sending input 1...
checking for output "6 + 6 ="...

:) At Level 2, Little Professor generates addition problems using 10–99
Log
running python3 testing.py main...
sending input 2...
checking for output "59 + 63 ="...

:) At Level 3, Little Professor generates addition problems using 100–999
Log
running python3 testing.py main...
sending input 3...
checking for output "964 + 494 ="...

:( Little Professor generates 10 problems before exiting

Cause
    timed out while waiting for program to exit
Log
running python3 testing.py main...
sending input 1...
sending input 12...
sending input 4...
sending input 15...
sending input 10...
sending input 12...
sending input 12...
sending input 10...
sending input 6...
sending input 10...
sending input 12...

:| Little Professor displays number of problems correct
 
Cause
    can't check until a frown turns upside down
:| Little Professor displays EEE when answer is incorrect
 
Cause
    can't check until a frown turns upside down
:| Little Professor shows solution after 3 incorrect attempts
 
Cause
    can't check until a frown turns upside down
To see more detailed results go to https://submit.cs50.io/check50/eeff9b18516dcb839d9c0fd50c2d64a0d2b86dc8
:) professor.py exists
Log
checking that professor.py exists...

:) Little Professor rejects level of 0
Log
running python3 testing.py get_level...
sending input 0...
checking that input was rejected...

:) Little Professor rejects level of 4
Log
running python3 testing.py get_level...
sending input 4...
checking that input was rejected...

:) Little Professor rejects level of "one"
Log
running python3 testing.py get_level...
sending input one...
checking that input was rejected...

:) Little Professor accepts valid level
Log
running python3 testing.py get_level...
sending input 1...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 2...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 3...
checking that program exited with status 0...

:) At Level 1, Little Professor generates addition problems using 0–9
Log
running python3 testing.py main...
sending input 1...
checking for output "6 + 6 ="...

:) At Level 2, Little Professor generates addition problems using 10–99
Log
running python3 testing.py main...
sending input 2...
checking for output "59 + 63 ="...

:) At Level 3, Little Professor generates addition problems using 100–999
Log
running python3 testing.py main...
sending input 3...
checking for output "964 + 494 ="...

:( Little Professor generates 10 problems before exiting

Cause
timed out while waiting for program to exit
Log
running python3 testing.py main...
sending input 1...
sending input 12...
sending input 4...
sending input 15...
sending input 10...
sending input 12...
sending input 12...
sending input 10...
sending input 6...
sending input 10...
sending input 12...

:| Little Professor displays number of problems correct
 
Cause
can't check until a frown turns upside down
:| Little Professor displays EEE when answer is incorrect
 
Cause
can't check until a frown turns upside down
:| Little Professor shows solution after 3 incorrect attempts
 
Cause
can't check until a frown turns upside down 
Results for cs50/problems/2022/python/professor generated by check50 v3.3.11
:) professor.py exists
:) Little Professor rejects level of 0
:) Little Professor rejects level of 4
:) Little Professor rejects level of "one"
:) Little Professor accepts valid level
:) At Level 1, Little Professor generates addition problems using 0–9
:) At Level 2, Little Professor generates addition problems using 10–99
:) At Level 3, Little Professor generates addition problems using 100–999
:( Little Professor generates 10 problems before exiting
    timed out while waiting for program to exit
:| Little Professor displays number of problems correct
    can't check until a frown turns upside down
:| Little Professor displays EEE when answer is incorrect
    can't check until a frown turns upside down
:| Little Professor shows solution after 3 incorrect attempts
    can't check until a frown turns upside down
To see more detailed results go to https://submit.cs50.io/check50/eeff9b18516dcb839d9c0fd50c2d64a0d2b86dc8
Source Link

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 = generate_integer(l)
        guesses = 3
        while guesses > 0:
            guess = input(str(n1)+" + "+str(n2)+" = ")
            if guess == str(n1 + n2):
                score += 1
                break
            else:
                print("EEE")
                guesses -= 1
        if guesses == 0:
            print(str(n1)+" + "+str(n2)+" = "+str(n1+n2))
    print("Score: "+str(score))


def get_level():
    while True:
        l = input("Level: ")
        if l.isnumeric():
            if 0 < int(l) <= 3:
                return int(l)


def generate_integer(level):
    if level == 1:
        return random.randrange(0, 9)
    elif level == 2:
        return random.randrange(10, 99)
    else:
        return random.randrange(100, 999)


if __name__ == "__main__":
    main()

And my checks look like:

:) professor.py exists
Log
checking that professor.py exists...

:) Little Professor rejects level of 0
Log
running python3 testing.py get_level...
sending input 0...
checking that input was rejected...

:) Little Professor rejects level of 4
Log
running python3 testing.py get_level...
sending input 4...
checking that input was rejected...

:) Little Professor rejects level of "one"
Log
running python3 testing.py get_level...
sending input one...
checking that input was rejected...

:) Little Professor accepts valid level
Log
running python3 testing.py get_level...
sending input 1...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 2...
checking that program exited with status 0...
running python3 testing.py get_level...
sending input 3...
checking that program exited with status 0...

:) At Level 1, Little Professor generates addition problems using 0–9
Log
running python3 testing.py main...
sending input 1...
checking for output "6 + 6 ="...

:) At Level 2, Little Professor generates addition problems using 10–99
Log
running python3 testing.py main...
sending input 2...
checking for output "59 + 63 ="...

:) At Level 3, Little Professor generates addition problems using 100–999
Log
running python3 testing.py main...
sending input 3...
checking for output "964 + 494 ="...

:( Little Professor generates 10 problems before exiting

Cause
timed out while waiting for program to exit
Log
running python3 testing.py main...
sending input 1...
sending input 12...
sending input 4...
sending input 15...
sending input 10...
sending input 12...
sending input 12...
sending input 10...
sending input 6...
sending input 10...
sending input 12...

:| Little Professor displays number of problems correct

Cause
can't check until a frown turns upside down
:| Little Professor displays EEE when answer is incorrect

Cause
can't check until a frown turns upside down
:| Little Professor shows solution after 3 incorrect attempts

Cause
can't check until a frown turns upside down 

It looks like my code is not generating ten problems before exiting. However when I test my code it generates ten problems and displays my score. Yet I am still not passing the check.

Any ideas would be appreciated!