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

Wrong solution on line 1953 #82

Open
Joshua-Burt opened this issue Aug 5, 2019 · 2 comments
Open

Wrong solution on line 1953 #82

Joshua-Burt opened this issue Aug 5, 2019 · 2 comments

Comments

@Joshua-Burt
Copy link

Joshua-Burt commented Aug 5, 2019

Please write a program to generate a list with 5 random numbers between 100 and 200 inclusive.

The solution shown is
print(random.sample(range(100), 5))

However that will only generate numbers between 0 and 100, but the question asks for 100 to 200.

The solution should be
print(random.sample(range(100, 200), 5))

@tictaktoe333
Copy link

tictaktoe333 commented Jan 18, 2020

The solution should be
print(random.sample(range(100, 201), 5))

Since 200 should be included in the output, your solution forgot that range stop is n-1

@amitShindeGit
Copy link

Thank you,Joshua-Burt and ticktaktoe33 for pointing this out,made a PR regarding the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants