1
Question Question 1
Which of the following will result in an error for a given valid dictionary D?
- D + 3
- D * 3
- D + {3 : "3"}
- D.update( {3 : "3"})
- D.update { {"3" : 3}}
- D.update("3" : 3)
- D + 3 — This will result in an error as dictionary does not support + operation.
- D * 3 — This will result in an error as dictionary does not support * operation.
- D + {3 : "3"} — This will result in an error as dictionary does not support + operation..
- D.update( {3 : "3"}) — This will execute with no error since valid dictionary is passed to update( ) method.
- D.update { {"3" : 3}} — This will result in an error since update( ) method syntax used here is invalid.
- D.update("3" : 3) — This will result in an error since update( ) method always takes dictionary as it arguments which is not passed here. Hence it will lead to an error.