Problem 1 def concatenate(L): i=0 s="" while i < len(L): s = s + L[i] i=i+1 return s Problem 2 def isSorted(L): i=1 while i < len(L): if (L[i-1] <= L[i]): i=i+1 else: return False return True Problem 3 def subsetOf(L1,L2): i=0 while i < len(L1): if L1[i] in L2: i = i+1 else: return False return True Problem 4 def gradeDistribution(examScores): distribution = [0]*10 for score in examScores: if score==0: distribution[0] = distribution[0]+1 else: distribution[(score-1)/10] = distribution[(score-1)/10]+1 return distribution Problem 5 def upperCase(L): i=0 Sl=[] while i < len(L): word = L[i] if (word[0] >= "A" and word[0] <= "Z"): Sl.append(word) i = i+1 return Sl Problem 6 def anotherUpperCase(L): i=0 while i < len(L): word = L[i] if (word[0] >= "a" and word[0] <= "z"): L.remove(word) i = i-1 i = i+1 Problem 7 def makeLower(word): i = 1 convertedWord = word[0] while i < len(word): if (word[i] >= "A" and word[i] <= "Z"): convertedWord = convertedWord + chr(ord("a") + ord(word[i]) - ord("A")) else: convertedWord = convertedWord + word[i] i = i+1 return convertedWord Problem 8 def maxPairSum(L): i = 1 MaxSum =L[0]+L[1] MaxSumList = [L[0],L[1]] while i < len(L)-1: if(L[i]+L[i+1]) >MaxSum: MaxSum = L[i]+L[i+1] MaxSumList = [L[i],L[i+1]] i = i+1 return MaxSumList Problem 9 def minIndex(L): smallest = L[0] smallestIndex = 0 i=1 while i < len(L): if L[i] < smallest: smallestIndex = i smallest = L[i] i = i+1 return smallestIndex Problem 10 def moveMin(L): index = minIndex(L) if index > 0: element = L[index] L.remove(element) L.insert(0,element)