Skip to content

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

Open
@Makaze

Description

@Makaze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CS50PCS50 Python

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions