Answer:
"64" is the output of the above code.
Explanation:
- The function holds the expression with (**) operator which is used to calculate the power in python language.
- So if we write 2**4, then this will give 16 as output. It is because when we calculate the
, then it will become 16. - The above question passes the num1 and num2 value in the function as an argument which is 3 and 4.
- So 3 will be initialized for x variable and 4 is for y variable.
- So when we calculate
then it will become
which will become 16. - So 64 is the output for the above question.
The last one is audio, the third one is animation and the first one is graphics so
Answer:
Explanation:
The following code is written in Python. It creates a method for each one of the questions asked and then tests all three with the same test case which can be seen in the picture attached below.
def alternating_list(lst1, lst2):
lst3 = []
for x in range(len(lst1)):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
if len(lst2) > len(lst1):
lst3.extend(lst2[len(lst1):])
return lst3
def reverse_alternating(lst1, lst2):
lst3 = []
if len(lst1) == len(lst2):
for x in range(len(lst1) - 1, -1, -1):
lst3.append(lst1[x])
lst3.append(lst2[x])
return lst3
def alternating_list_no_extra(lst1, lst2):
lst3 = []
max = 0
if len(lst1) > len(lst2):
max = len(lst2)
else:
max = len(lst1)
for x in range(max):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
return lst3