Python - Videos and Questions

60 / 78

Tick all correct answers:

Say we have a dictionary numbers Running the statement numbers["3"] = "Three" will ...


Note - Having trouble with the assessment engine? Follow the steps listed here


No hints are availble for this assesment

Answer is not availble for this assesment

Please login to comment

25 Comments

This comment has been removed.

numbers = { }

numbers["3"] = "Three"

print(numbers)

Update the value of key "3" to "Three" if the key "3" exists

Create a key value pair of "3" and "Three" if the key "3" does not exist

  Upvote    Share

Incorrect answer. ????????????

  Upvote    Share

Hi,

There are multiple correct answers to this question, are you selecting only one of them?

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

hello sir,
It's showing that the answer is incorrect I have solved this prob in jupiter also to cross verify ,then why it's showing so,Please help me in that
Thanks

  Upvote    Share

can you please let me know is my answer wrong or right,
Thanks

  Upvote    Share

Hi,

The answer that you had selected is right, but there is another answer which is right too, and you need to select that along with this one.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi,

There are multiple correct answers to this question, you have marked only one of them.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

There is an issue with this question. I tried the 1st and the 2nd option for answer and it just says incorrect answer! Can you please fix this issue.

  Upvote    Share

Question is correct. Please select the correct answers. Also try it on the Python shell or notebook

  Upvote    Share

Thank you, I got the right answer!

  Upvote    Share

i am trying to select the option 2 but it says incorrect answer :(

  Upvote    Share

Hi, Mamta.

Are you sure 2nd only is correct answer?
As per the concept of dictionary numbers["3"] = "Three" also updates the value for key "3".
You can try it in Python shell.

All the best.

--
Best,
Satyajit Das

  Upvote    Share

Say we have a dictionary numbers Running the statement numbers["3"] = "Three" will ...

update the value of key "3" to "Three" if the key "3" exists
create a key value pair of "3" and "Three" if the key "3" does not exist
cause a KeyError

This question has no correct answer..

  Upvote    Share

Hi, Rajiv.

Can you please look it again?
numbers["3"]="Three" will update the value to "Three" with key "3" exits also it will create a key value pair if key "3" does not exits.

All the best.

  Upvote    Share

pls check all options it is showing incorrect answer Qtn no 60

  Upvote    Share

Hi, Rupali.

By the concept of dictionary.

mydict={}
mydict[key]=value for updating the key value.
Note :- Here "key" and "value" can be integer or string.
1) If you are using mydict["3"]="Three" then it will create a key value pair if don't exit.
2) If you do mydict["3"]="Four" the it will update the value "Three" to "Four" for key as "3".
You can try it in Python shell.

All the best.

  Upvote    Share

-- Please reply above this line --

Hi,

By the concept of dictionary.
mydict={}
mydict[key]=value for updating the key value.
Note :- Here "key" and "value" can be integer or string.
1) If you are using mydict["3"]="Three" then it will create a key value pair if don't exit.
2) If you do mydict["3"]="Four" the it will update the value "Three" to "Four" for key as "3".

You can try it in Python shell.

All the best.

--
Best,
Satyajit Das

  Upvote    Share

its giving incorrect for any answer

  Upvote    Share

-- Please reply above this line --

Hi,
By the concept of dictionary.
mydict={}
mydict[key]=value for updating the key value.

Note :- Here "key" and "value" can be integer or string.
1) If you are using mydict["3"]="Three" then it will create a key value pair if don't exit.
2) If you do mydict["3"]="Four" the it will update the value "Three" to "Four" for key as "3".
You can try it in Python shell.

--
Best,
Satyajit Das

  Upvote    Share

thank you

  Upvote    Share

incomplete question, pls check it

  Upvote    Share

Hi, Retheesh.

By the concept of dictionary.
mydict={}
mydict[key]=value for updating the key value.
Note :- Here "key" and "value" can be integer or string.
1) If you are using mydict["3"]="Three" then it will create a key value pair if don't exit.
2) If you do mydict["3"]="Four" the it will update the value "Three" to "Four" for key as "3".
You can try it in Python shell.

All the best.

  Upvote    Share

60 is not understandable

  Upvote    Share

Thank you for letting us know. Please check now.

  Upvote    Share