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
16
17
17
18
// Questions
18
19
19
20
// a) When formatTimeDisplay is called how many times will pad be called?
20
-
// =============> write your answer here: When formatTimeDisplay is called four times pad will be called, one for remainingSeconds, one for remainingMinutes, one for totalMinutes and one for totalHours.
21
+
// =============> write your answer here: When formatTimeDisplay is called three times pad will be called, one for 'remainingSeconds', one for 'remainingMinutes', and one for 'totalHours'.
21
22
22
23
// Call formatTimeDisplay with an input of 61, now answer the following:
23
24
24
25
// b) What is the value assigned to num when pad is called for the first time?
25
-
// =============> write your answer here: When pad is called for thee first time, num will be assigned the value of 1, which is the value of remainingSeconds.
26
+
// =============> write your answer here: When pad is called for thee first time, num will be assigned the value of totalHours.
26
27
27
28
// c) What is the return value of pad is called for the first time?
28
-
// =============> write your answer here: The return value of pad when called for the first time will be `01` because it pads the number 1 with a leading zero to make it two digits.
29
+
// =============> write your answer here: The return value of pad when called for the first time will be `pad(totalHours)` for example if the return of 'totalHours' is '1' we will add '0' to make it two digits('01').
29
30
30
31
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
31
-
// =============> write your answer here: When pad is called for the last time, num will be assigned the value of 0, which is the value of totalHours.
32
+
// =============> write your answer here: When pad is called for the last time, num will be assigned the value of 'remainingSecond'.
32
33
33
34
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
34
-
// =============> write your answer here: when pad is called for the last time, the return value will be `0` because it pads the number 0 with a leading zero to make it two digits.
35
+
// =============> write your answer here: when pad is called for the last time, the return value will be `pad(remainingSecond)`.
0 commit comments