Lab 4

lab description:

In this lab, I was told to do two exercises. In the first exercise, I had to write a function in which it reads the statement backwards. It took some time for me to do it but i eventually did it. In the second exercise, I had to write a function  that takes a list of numbers and returns the cumulative sum. I was a bit confuse so I just did what I thought was it for the exercise..

code source:

fruit='banana'
print (fruit)
index=-1
while index<len(fruit):
letter=fruit[index]
index=index-1
print (letter)
if index ==-7:
break

t=[1,2,3]
sum (t[0:1])
sum (t[0;2])
sum (t[0:3])
t[0:3]=[1,3,6]
print (t)

Screenshot:8.1

10

Leave a Reply

Your email address will not be published. Required fields are marked *