Answer to Question #91181 in Python for Promise Omiponle

Question #91181
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
1
Expert's answer
2019-06-26T14:27:06-0400
  1. 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]
  2. It will give exception, because we can't concatinate string with integers.
  3. It will give exception, because string object does not support item assignment. So we can't change one letter by access via index.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS