#the first error will be in statement 8
x = ["slithy",[7,10,12],2,"tove",1] # Statement 1
w = x # Statement 4
w[0][:3] = 'fea' # Statement 8
# TypeError: 'str' object does not support item assignment
# type(w[0][:3]) str;w[0][:3] == 'sli'
#in python strings are not mutable objects
#second error in a = (x[4] == 1) # Statement 10
# type(x[4]) int and x[4]==1
#'int' object is not subscriptable
# expression x[4][1] will throw an error
# Answer 8 and 10 statement generates an error
Comments
Leave a comment