You need data which can act as a simple telephone directory. You can obtain it with the following clauses (Choose two.) (assume that no other items have been created before)
A.
dir={'Mom': 5551234567, 'Dad': 5557654321}
B.
dir= {'Mom': '5551234567', 'Dad': '5557654321'}
Correct: A,B
print("A.",{'Mom': 5551234567, 'Dad': 5557654321})
print("B.", {'Mom': '5551234567', 'Dad': '5557654321'})
#print("C.", {Mom: 5551234567, Dad: 5557654321}) # NameError: name 'Mom' is not defined
#print("D.", {Mom: '5551234567', Dad: '5557654321'}) # NameError: name 'Mom' is not defined
A dictionary cannot hold variable as key (since no other items have been created before), so C and D aren't correct answers. Keys should be literals here
"NameError: name 'Mom' is not defined " will happen as it will as it it will think Mom is a variable that is undefined since it is not in '' or "" like string should be
A lot of correct answers in the comments are wrong in one thing - a dictionary key does not have to be quoted, unless it's a string. It is an important distinction to saying "keys should be quoted" which is not the case.
Note the condition: "..no other items have been created before." Without enclosing Mom and Dad inside quotes(to make then string literals), they remain undefined variables.
Correct answers are A and B. Since the keys in a dictionary should be in quotes, so C and D are incorrect. The values in a dictionary may or may not be under quotes, so A and B are correct.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
technoguy
Highly Voted 2 years, 12 months agoJeyTlenJey
Most Recent 3 months, 4 weeks agoSanela
6 months, 1 week ago25Topaz
11 months, 2 weeks agoJeffriXu
1 year agoValcon_doo_NoviSad
1 year, 1 month agoAcid_Scorpion
1 year, 2 months agoSadaiyan
1 year, 6 months agodicksonpwc
1 year, 7 months agoNorbiox
1 year, 11 months agoValcon_doo_NoviSad
1 year, 1 month agojaimebb
2 years agoHanjito
2 years, 1 month agoN9
2 years, 2 months agoJnanada
2 years, 3 months agoPremJaguar
2 years, 4 months agoVan_Rossum
2 years, 4 months agoSuvabrata
2 years, 5 months ago