Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Cycle1/5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def x3(N,Z): #function to do the assigned task
fin=[] #final list that'll contain only the max elements of each list
temp=[] #temporary list that'll hold the i-th list for processing
for i in range(0,N):
print("Length of the ",i+1,"th list please?")
M=int(input()) #length of list to be entered
print("Enter the elements one by one. \n")
for j in range(M):
temp.append(int(input())) #accepts elements in the list
#print(str(max(temp))+"\n") #this was just to verify whether the program works upto this point
fin.append(max(temp))
S1=0
for i in range(len(fin)):
S1+=(fin[i]**3) #f(X)=X^3
#print(fin) #this was just to verify whether the program works upto this point
S=S1%Z #modulo of cubes of max numbers
return S #returns final value

def main():
print("Enter the number of lists and the modulo value.\n")
N=int(input())
Z=int(input())
print(x3(N,Z))

main()