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
15
16
// to help you answer these questions
@@ -18,17 +19,21 @@ function formatTimeDisplay(seconds) {
18
19
19
20
// a) When formatTimeDisplay is called how many times will pad be called?
20
21
// =============> write your answer here
22
+
// pad() is called 3 Times whenever formatTimeDisplay() is called.
21
23
22
24
// Call formatTimeDisplay with an input of 61, now answer the following:
23
-
24
25
// b) What is the value assigned to num when pad is called for the first time?
25
26
// =============> write your answer here
27
+
// The first call to pad() is 0, for totalHours which is 0
26
28
27
29
// c) What is the return value of pad is called for the first time?
28
30
// =============> write your answer here
31
+
// The return value is 00
29
32
30
33
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
31
34
// =============> write your answer here
35
+
// 1: -> pad() was called from line 11. Given that num is 0, the first call to pad() (for totalHours which is 0). There were two more calls to pad()(for remainingLastMinutes and remaining LastSeconds) and the value assigned to num for the last call is 0
32
36
33
37
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
34
38
// =============> write your answer here
39
+
//01 -> Given that num is 1, the last call to pad() (for remainingSeconds is 1) and the return value is 01,
0 commit comments