-
-
Notifications
You must be signed in to change notification settings - Fork 116
WEST-MIDLANDS-JAN-ITP|SEGUN FOLAYAN|STRUCTURING AND TESTING DATA|SPRINT1 #428
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
base: main
Are you sure you want to change the base?
WEST-MIDLANDS-JAN-ITP|SEGUN FOLAYAN|STRUCTURING AND TESTING DATA|SPRINT1 #428
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left you some comments and questions. Can you try answering those questions?
@@ -4,3 +4,4 @@ count = count + 1; | |||
|
|||
// 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 | |||
// Line three adds 1 to the value of count and stores it as count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Operation like count = count + 1
is very common in programming, and there is a programming term describing such operation.
May I suggest feeding the code to ChatGPT and see how else the code can be described? From time to time you may learn some new programming terms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The operation count = count + 1 is called increment.
Sprint-1/1-key-exercises/4-random.js
Outdated
|
||
// In this exercise, you will need to work out what num represents? | ||
// Try breaking down the expression and using documentation to explain what it means | ||
// It will help to think about the order in which expressions are evaluated | ||
// Try logging the value of num and running the program several times to build an idea of what the program is doing | ||
// Math.floor() method always rounds down and returns the largest integer less than or equal to a given number | ||
// Math.random() method returns a floating-point pseudo-random number in the range 0 to less than 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also express a range of values concisely using the interval notation.
Instead of saying "a number in the range 0 to less than 1", we can say "A number in [0, 1)".
You can ask ChatGPT "how to specify a range of numbers using interval notation" to learn more about such notation.
- What is the use of
(maximum - minimum + 1)
at line 4? - What is the use of of
+ minimum
at line 4? - What is the possible range of the value of
num
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1......The expression (maximum - minimum + 1) ensures that the random number is scaled to include the full range between minimum and maximum, inclusive.
2.....Without the + minimum, the range would be between 0-99 but we want it to be between 1-100
3.....The range of num is from 1 to 100, inclusive.
Sprint-1/2-mandatory-errors/4.js
Outdated
const 24hourClockTime = "08:53"; // This should be correctly written as "08:53 PM" in the 24 hour format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change you suggested does not fix the error in the code.
Can you try executing the code and suggest a solution to fix the errors indicated by the JS engine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got syntax errors indicating a problem with the numbers.
Javascript does not accept variables to start with numbers
The line 1 May be written as const twelveHourClockTime = "20:53",
The line 2 May be written as const twentyFourHourClockTime = "08:53"
|
||
// d) Interpret line 4, what does the expression assigned to totalMinutes mean? | ||
// d) Interpret line 4, what does the expression assigned to totalMinutes mean? Computes the the difference between movielength and remaining minutes. And divides this by 60. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your description is a literal translation (in English) of (movieLength - remainingSeconds) / 60
; the description does not give any new information about the calculated value.
Can you describe the value the expression calculates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculates the number of full completed minutes the movie takes
|
||
// e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
// e) What do you think the variable result represents? Can you think of a better name for this variable? It gived the time of the movie in hours, minutes and seconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question (e) has two parts. What is your answer to " Can you think of a better name for this variable?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable could be moviedurationHMS
|
||
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer. It does work for all number inputs. | ||
// f) For example, movieLength of 100 gives 0:-1:-40 and movieLength of 8784 gives 2:26:24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0:-1:-40
does not look normal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its my mistake, it should be 0: 1: 40
Sprint-1/4-stretch-explore/chrome.md
Outdated
|
||
What effect does calling the `alert` function have? | ||
What effect does calling the `alert` function have? This prints Hello world to the console: The browser displays "Hello world!" in a pop up window |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does alert()
print something to console
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: It displays "Hello world!" in a pop up window. Not to the console.
Sprint-1/4-stretch-explore/chrome.md
Outdated
What effect does calling the `prompt` function have? | ||
What is the return value of `prompt`? | ||
What effect does calling the `prompt` function have? It displays a dialog box that allows the user to give an input | ||
What is the return value of `prompt`? It displays a dialog box. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your answer does not describe what the "return value" is.
What is the return value of prompt()
if the user clicks "OK"? What is the return value of prompt()
if the user clicks "Cancel"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: prompt returns the string input typed in by the User.
If the user clicks okay, it returns the string typed in by the user.
If the user clicks Cancel, the return value in null.
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.