1. What will be the result of print W?
s=["apples", "bananas", "carrots]
W=[len(w) for w in s]
2. What is the output of print "hello"+1+2+3
3. What gets printed?
name = "snow storm"
name[5] = 'X'
print name
- Nothing because example have error. s=["apples", "bananas", "carrots] Not closed double quota in last item. But if we will close output will be: [ 6, 7, 7]
- It will give exception, because we can't concatinate string with integers.
- It will give exception, because string object does not support item assignment. So we can't change one letter by access via index.