You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
19
22
// to help you answer these questions
20
23
21
24
// Questions
22
25
23
26
// a) When formatTimeDisplay is called how many times will pad be called?
24
-
// =============> write your answer here
27
+
// =============> write your answer here: ***Answer*** :Function pad will be called 3 times.
25
28
26
29
// Call formatTimeDisplay with an input of 61, now answer the following:
27
30
28
-
// b) What is the value assigned to num when pad is called for the first time?
29
-
// =============> write your answer here
31
+
// b) What is the value assigned to num when pad is called for the first time?:
32
+
// =============> write your answer here: ***Answer*** : The value assigned to num =61.
30
33
31
34
// c) What is the return value of pad when it is called for the first time?
32
-
// =============> write your answer here
35
+
// =============> write your answer here: ***Answer*** :The value of pad when it is called for the first time is "00".
33
36
34
-
// 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
37
+
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer:
38
+
// =============> write your answer here: ***Answer***: The last call of pad in this program is pad(remainingSeconds) => remainingSeconds= (61%60=1) => num = 1.
36
39
37
40
// 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
41
+
// =============> write your answer here : ***Answer*** : The value of pad when is called for the last time is the third part in `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}` => pad(remainingSeconds)=pad(1) since 1 has a length <2 return will be padded with 0 => pad (1)return "01".
0 commit comments