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] [quads id=1] Question Read more…

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

Solution :- Download Python File :- Download import operator input(”) class Stu: def __init__(self, name, fname): self.name = name self.fname = fname self.num = 0 self.total = 0 def add(self, gr): self.num +=1 if gr==”A”: self.total +=10 elif gr==”AB”: self.total+=9 elif gr==”B”: self.total+=8 elif gr==”BC”: self.total+=7 elif gr==”C”: self.total+=6 elif Read more…