Lab 4

Lab Description: In this lab we were told to do exercises from chapter 8 strings and chapter 10 lists where we had to create functions using strings and lists.

Lab Experience: While doing this lab I encountered with a problem because I had made a minor mistake in the encoding replacing the function name other than that I also learned the difference between a len and   range.

Codes:

1) Chapter 8 Exercise 1:

def Jane(x=input(“enter desired string “)):
for s in x[::-1]:
print (s)

Jane()

2) Chapter 10 exercise 2:

def Aizen(s):
Gin = s[0],s[0]+s[1],s[0]+s[1]+s[2]
print (Gin)

Aizen([1,3,6])

Screenshots:

1) Chapter 8 Exercise 1:

 

lab 4 1

 

lab 4 1

 

2) Chapter 10 exercise 2:

lab 4 2 1

 

lab 4 22