London | 26-ITP-May | Zadri Abdule | Sprint 1 | Coursework#1300
Open
Zadri415 wants to merge 27 commits into
Open
London | 26-ITP-May | Zadri Abdule | Sprint 1 | Coursework#1300Zadri415 wants to merge 27 commits into
Zadri415 wants to merge 27 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
reviewed
May 11, 2026
Contributor
cjyuan
left a comment
There was a problem hiding this comment.
Code looks good. I just have a few comments.
|
|
||
| // Line 1 is a variable declaration, creating the count variable with an initial value of 0 | ||
| // Describe what line 3 is doing, in particular focus on what = is doing | ||
| // The = sign on line 3 means assignment. It takes whatever is on the right side, works it out, and then stores that result into a variable on the left. So count = count + 1 means take the current value of count, add 1, and then save that back into count. |
Contributor
There was a problem hiding this comment.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
Comment on lines
+12
to
+17
| // Math.random() returns a random decimal number between 0 and 1 | ||
| // (maximum - minimum + 1) represents the size of range of numbers we want to include. We add +1 because both minim and maximum are included in the range | ||
| // Math.random() * (maximum - minimum + 1) gives us a random decimal between 0 and 100, but still decimal | ||
| // Math.floor() rounds down to the nearest whole number. So this. turns decimals like 99.9 into 99 | ||
| // + minimum since minimum = 1, this shifts the entire random range up by 1. so instead of 0-100, the range becomes 1-100 | ||
| // num should return a random integer between 1 and 100 No newline at end of file |
Contributor
There was a problem hiding this comment.
Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.
One way to concisely and precisely describe a range of values is to use the math's interval notation:
[,]=> inclusion(,)=> exclusion
For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Completed all of the tasks for Sprint 1 of Module Structuring & Testing Data.