Answer:
(a): power(2&-2)
The code is as follows:
power = 2**-2
print(power)
(b): Largest and smallest in a list
The code is as follows:
num = [33,6,11,100,456,109,-4,366]
smallest= min(num)
largest= max(num)
print(smallest)
print(largest)
(c): Loop in Python
(i) Loop are instructions that are repeated until a certain condition is met;
(ii) For loop, in python are used to iterate over a sequence or through a certain range;
The syntax is:
for loop_element in range(iterating_range):
The following is an illustration of for loop that iterates 5 times
for i in range(5):
Explanation:
(a): power(2&-2)
The ** is used to calculate power.
So, 2**-2 represents 2 raise to power -2
power = 2**-2
This prints the calculated power
print(power)
(b): Largest and smallest in a list
This initializes the list
num = [33,6,11,100,456,109,-4,366]
This calculates the smallest using min() function
smallest= min(num)
This calculates the largest using max() function
largest= max(num)
This prints the smallest and the largest
print(smallest)
print(largest)
(c): See answer section