Description : Lab report 4 contains 2 exercises
Code:
def WordBackwards(word): index = len(word) - 1 while index >=0: letter = word[index] print (letter) index = index - 1 Phrase = input("Please input a phrase ") WordBackwards(Phrase)
Code
def CumulativeSum(): list = ['5', '8', '11', '85'] index = 1 while index < int(len(list)): x = int(list[index]) y = int(list[index - 1]) z = x + y list[index] = z index = index + 1 print (list) CumulativeSum()