CSCA08H3 Lecture Notes - Lecture 4: 5,6,7,8

55 views2 pages

Document Summary

Return a copy of lista with the elements of listb inserted at the index. # if lista is string if(type(lista) is str): # convert string to list lista = list(lista) # convert string to list listb = list(listb) # join c,d,e f = (c, d, e) # find a from begning to index a = lista[0:index] # join the rest of a to a a. extend(lista[index:]) return a def up_to_first(str1, obj): Returns a copy of the list up to (but not including) the first occurrence of that object,or all of the elements if that object is not in the list. # if str1 is string if(type(str1) is str): # let str1 to be list list1 = list(str1) # find the position of index index = str1. find(obj) # str1 from begnning to object s = str1[0:obj-1] # return the result return s def cut_list(list2, index): (list,int)-> list.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions