Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS50P Week 4 Psets "Guessing Game" and "Little Professor" fail check50 work with valid, but hand-made, randint functions #217

Open
Makaze opened this issue Dec 26, 2023 · 0 comments
Labels
CS50P CS50 Python

Comments

@Makaze
Copy link

Makaze commented Dec 26, 2023

Many languages, e.g. JavaScript, use the same type of random() which generates between [0,1) and suggest the following randrange() implementation:

import random


def custom_randrange(max):
    return int(random.random() * max)

A student may be able to make a program that correctly follows the specification using this implementation and still fails check50.

This will fail check50 despite producing numbers in the correct range per the specification. The problem set could make this explicit by checking if the student uses random.randrange() or random.randint() and checking for different results depending on the implementation.

Alternatively, make the required methods explicitly required in some way.

@Makaze Makaze changed the title CS50P Week 4 Pset "Little Professor" doesn't work with valid, but hand-made, randint function CS50P Week 4 Psets "Guessing Game" and "Little Professor" fail check50 work with valid, but hand-made, randint functions Dec 26, 2023
@rongxin-liu rongxin-liu added the CS50P CS50 Python label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CS50P CS50 Python
Projects
None yet
Development

No branches or pull requests

2 participants