Skip to content

Commit ae508fc

Browse files
Answer the question using pythontutor site
1 parent 528fd79 commit ae508fc

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎Sprint-3/4-mandatory-interpret/time-format.js‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@ function formatTimeDisplay(seconds) {
1414

1515
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
17-
17+
console.log(formatTimeDisplay(61));
1818
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1919
// to help you answer these questions
2020

2121
// Questions
2222

2323
// a) When formatTimeDisplay is called how many times will pad be called?
24-
// =============> write your answer here
24+
// =============> The pad function is called three times on line 15.
2525

2626
// Call formatTimeDisplay with an input of 61, now answer the following:
2727

2828
// b) What is the value assigned to num when pad is called for the first time?
29-
// =============> write your answer here
29+
// =============> The value assigned to num is 0.
3030

3131
// c) What is the return value of pad when it is called for the first time?
32-
// =============> write your answer here
32+
// =============> The value of pad when it is called for the first time "00".
3333

3434
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
35-
// =============> write your answer here
35+
// =============> The value assign to num is 1.
36+
// because the last call to pad is pad(remainingSeconds), and remainingSeconds is 1
37+
// when formatTimeDisplay(61) is called.
3638

3739
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
38-
// =============> write your answer here
40+
// =============> The return value is "01" because the last call to pad is pad(1).
41+
// The pad function add a zero to make the number two digits.

0 commit comments

Comments
 (0)