Lab Description:
A Description of the Lab will go here.
Code:
Exercise #1: Code is below:
def backward():
userstring=input(‘Please input a string:\n’)
userstringlen=len(userstring)
userstringindex=userstringlen-1
for char in userstring:
userstringlast=userstring[userstringindex]
print(userstringlast)
userstringindex=userstringindex-1
backward()
Exercise #3: Code is below:
list = [int(), int() , int()]
list[0] = int ( input (‘What is your first value?\n’))
list[1] = int ( input (‘What is your second value?\n’))
list[2] = int ( input (‘What is your third value?\n’))
sumlist = [list[0], list[0]+list[1], list[0]+list[1]+list[2] ]
print (list)
print (sumlist)
No comments