IDNLearn.com: Where your questions meet expert advice and community insights. Our Q&A platform offers reliable and thorough answers to help you make informed decisions quickly and easily.
Sagot :
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
We greatly appreciate every question and answer you provide. Keep engaging and finding the best solutions. This community is the perfect place to learn and grow together. IDNLearn.com has the solutions to your questions. Thanks for stopping by, and come back for more insightful information.