Lab 2 Work
Lab 2 Work
Step 1:
Answers:
1. If the player selects a number between 0 and 128—yes, the operation can catch.
The range is initially set at 0 to 128 with the average being determined at the
midway. The upper bound of the range (b) is lowered to 64 if the player indicates
that the midpoint (64 on the first guess) is too high. If the value is 0, then additional
guesses continue to half the range downward towards 0. With a few steps, this
approach guarantees that the range narrows enough to include 0.
In a similar vein, if 128 is selected, the estimates that follow half the remaining
range once more, but this time they do so in an upward direction toward 128 due to
the feedback that the midpoint is too low. The method is intended to effectively
narrow down on the desired number by iteratively modifying the range in response
to player input and recalculating the midpoint. This guarantees that, within the six
attempts permitted by the process's criteria, even the boundary values of 0 and 128
can be correctly estimated.
Part B
Basic Python Programming
B1 – Launch Python from Windows 10 or else
B2 – Python Basics
Step 1: Python programming in the interactive interpreter.
1.
2.
3.
4.
5.
6.
7.
8.
9.
2.
3.
4.
5.
Part C
More Python Programming
1.
3.
4.
5.
6.
Saving and Executing your code
7, 8.
9,10,11
12.
13.
14.
19
20
21
22
23
25
26.
27.
28.
34.
35.
36.
37.