NPTEL solution

Week 3 | Programming Assignment | Programming, Data Structures and Algorithms using Python | Apr 2018

Download Python File :- Raw File | Download (Please rename it to .py file once downloaded, for it to run) def alternating(l): if(len(l)>1): if(l[0]>l[1]): for i in range(len(l)-1): if(l[i]==l[i-1]): return False if(i%2==0): if(l[i] lst[i+1]: return False return True def matmult(X,Y): col= len(Y[0]) row= len(X) result = [[0 for i in range(col)] for Read more…

By Yash Sodha, ago
NPTEL solution

Solution for NPTEL Programming, Data Structures and Algorithms using Python, Week 8 Programming Assignment

Question :- Find the longest palindrome As we all know, a palindrome is a word that equals its reverse. Here are some examples of palindromes: malayalam, gag, appa, amma. We consider any sequence consisting of the letters of the English alphabet to be a word. So axxb,abbba and bbbccddx are words for our purpose. And aaabbaaa, Read more…

By Yash Sodha, ago
NPTEL solution

ONLINE TEST 2-5 PM | Solution for NPTEL Programming, Data Structures and Algorithms using Python

All answers have been verified. Question – 1 :- Here is an function to return the maximum value in a list of integers. There is an error in this function. Provide an input list for whichmaxbad produces an incorrect output. def maxbad(l):   mymax = 0   for i in range(len(l)):     if l[i] > mymax:        mymax = l[i]   return(mymax) Answer:- [-3,-2,-1] Question – 2:- Read more…

By Yash Sodha, ago