Search Header Logo

Python - Loop Dictionaries - 6

Authored by Amy Austin

Other

12th Grade

Python - Loop Dictionaries - 6
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to loop through the values of a dictionary in Python?

keys()

values()

items()

loops()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method returns the keys of a dictionary?

getKeys()

keys()

keySet()

allKeys()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you loop through both keys and values of a dictionary?

for key, value in dictionary.values():

for key in dictionary.keys():

for key in dictionary:

for key, value in dictionary.items():

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to print all key names in a dictionary, one by one?

print(allKeys in dictionary)

print(dictionary.keys())

for x in dictionary: print(x)

dictionary.printKeys()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a valid method for dictionaries in Python?

items()

values()

delete()

copy()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you add items to a dictionary?

dictionary[key] = value

add.dictionary(key:value)

dictionary.add(key:value)

dictionary.append(key:value)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to copy a dictionary?

copyDict()

duplicate()

clone()

copy()

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?