generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 240
ITP_JAN-2015|sabita-Shrestha|Module-Structuring-and-Testing-Data|week5|sprint1 #260
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
Closed
SabitaShrestha325
wants to merge
12
commits into
CodeYourFuture:main
from
SabitaShrestha325:Coursework-planner-sprint-1
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
05d1112
key exercises
SabitaShrestha325 8651354
Updated key exercises and fixed mandatory errors
SabitaShrestha325 7e1a21b
spelling correction
SabitaShrestha325 9448fdf
mandatory-error
SabitaShrestha325 097d88e
done 3-mandatory-interpret
SabitaShrestha325 2a1f2de
explanation about expression, operand and operator
SabitaShrestha325 5efd683
change to return
SabitaShrestha325 b96d284
expression detail is added
SabitaShrestha325 0bf7256
fixed camelcase
SabitaShrestha325 feca213
modify through type conversion
SabitaShrestha325 9949ef4
change ans as advised
SabitaShrestha325 2ec27d1
modify ans
SabitaShrestha325 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| // Buy using comments syntax which is 2 slash |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| let age = 33; | ||
| age = age + 1; | ||
| console.log(age); | ||
| // I have change const to let, It won't let you to reassign, it will say error if we use const. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
|
|
||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); | ||
| // variable should declare before console.log. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
|
|
||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = String(cardNumber).slice(-4); // convert to string and extract last 4 digit | ||
| console.log(last4Digits); //print4213 | ||
| // The last4Digits variable should store the last 4 digits of cardNumber | ||
| // However, the code isn't working | ||
| // Before running the code, make and explain a prediction about why the code won't work | ||
| // Then run the code and see what error it gives. | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
|
||
| //IN line 1 their was't any string that may be the reason. | ||
| //With out changing code its says TypeError | ||
|
|
||
| /* how would you modify the code (through type conversion) so that it can still extract the last 4 digits from its value. | ||
| To use slice() method we need to use string. | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| const twelveHourClockTime = "20:53"; | ||
| const twentyFourHourClockTime = "08:53"; | ||
| console.log(twelveHourClockTime); | ||
| console.log(twentyFourHourClockTime); | ||
| //it says syntax error because variable should start with letter or underscore. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,27 @@ console.log(`£${pounds}.${pence}`); | |
| // This program takes a string representing a price in pence | ||
| // The program then builds up a string representing the price in pounds | ||
|
|
||
| // You need to do a step-by-step breakdown of each line in this program | ||
| // Try and describe the purpose / rationale behind each step | ||
| // with the value "399p"You need to do a step-by-step breakdown of each line in this program | ||
| // Try and describe the purpose / rationale behind each stepconst penceString = "399p"; | ||
|
|
||
| // To begin, we can start with | ||
| // 1. const penceString = "399p": initialises a string variable with the value "399p" | ||
| // 1. const penceString = "399p": initializes a string variable | ||
| // this one initializes the penceString value with of 399 in pence. | ||
|
|
||
| //const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); | ||
| //In this line,the last character of penceString variable will be remove and converts price string like "399p" will be 399. | ||
| // | ||
|
|
||
| //const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); | ||
| //This line make sure the string "penceStringWithoutTrailingP" has 3 character and also adding "0" if necessary and it also penceStringWithoutTrailingP is "99" also padded to "099". | ||
|
|
||
| //const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); | ||
| //This line remove the part of the string which is pound and substring from the start(0) to characters before the end paddedPenceNumberString. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by "... to characters before the end paddedPenceNumberString"? |
||
|
|
||
| //const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) .padEnd(2, "0"); | ||
| //This line of code extracts 2 characters of the string "paddedPenceNumberString" also pads the results to make sure it has 2 characters by adding 0 to format properly. | ||
| //Calculate the starting index of the last two characters of 399 (length - 2) input will be 99. | ||
| // It also Extract everything from that point to the end of the string using substring(). | ||
|
|
||
| //console.log(`£${pounds}.${pence}`); | ||
| // It will print price in pound and pence in format. which will print 3.99 | ||
Oops, something went wrong.
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.
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.
You gave a literal translation of the code, but it does not quite explain what the expression
(movieLength - remainingSeconds) / 60does.Can you describe in terms of whole minute, or use ChatGPT to find out how else the code can be described?
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.
hi, Cjyuan, thank you for your review, I have changed the ans as it was mention. Can you please review.