Exr. 8.1
def reverse_string (word):
limit = len(word) * -1
index = -1
while index >= limit:
letter = word[index]
print letter
index = index – 1
reverse_string(“word”)
———————————————————————————————–
Exr. 10.3
def cum_sum(start_list): my_sum = 0 sum_list = [] for i in range(len(start_list)): my_sum += start_list[i] # print my_sum # the original idea of sum_list[i] = my_sum *does not work* sum_list.append(my_sum) return sum_list
def main(): start_list = [1,2,3] print cum_sum(start_list)
if __name__ == ‘__main__’: main()