In: Computer Science
a )
a ) i ) [0,8,64]
ii ) [729,512,343,216,125,64,27,8,1,0]
b ) #Let a be the 1D array
for i in a:
print(i)
========================================================================================
c )
n = int(input("Enter your semester number: "))
if (n%2)!=0: #checking whether the semester is odd
print("Short vacation.")
else:
print("Long vacation.")
========================================================================================
d )
import numpy as np
sum = 0
percentage = 0
l = np.array([[1,2,3,4,5,6,7],[10,20,30,40,50,60,70]])
for i in range(6):
sum += l[1][i]
percentage += (l[1][i] / 100)*100
average_percentage = (percentage) / 6
print("Total sum is: ", sum)
print("Average percentage is: ", average_percentage)
========================================================================================
ANSWERED AS PER KNOWLEDGE
IF ANY DOUBT COMMENT IT