GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

What happens if you try to run sum(list(user_roles.values())…

What happens if you try to run sum(list(user_roles.values())) where user_roles = {“alice”: “admin”, “bob”: “editor”}?

Read Details

If sales_data = [{“day”: “Mon”, “amount”: 100}, {“day”: “Tue…

If sales_data = [{“day”: “Mon”, “amount”: 100}, {“day”: “Tue”, “amount”: 150}]. How would you sum the “amount” values using concepts covered? (Without loops).

Read Details

Which expression correctly checks if the key “port” exists i…

Which expression correctly checks if the key “port” exists in the dictionary settings?

Read Details

Start with d = {}. Then execute d[‘a’] = 1, d[‘b’] = 2, d[‘c…

Start with d = {}. Then execute d[‘a’] = 1, d[‘b’] = 2, d[‘c’] = 3, d.pop(‘b’). What is len(d)?

Read Details

Given keys = [‘a’, ‘b’, ‘c’] and values = [1, 2, 3], what do…

Given keys = [‘a’, ‘b’, ‘c’] and values = [1, 2, 3], what does {k: v for k, v in zip(keys, values)} produce?

Read Details

If data = {“item”: “Book”, “qty”: 5} and you execute data[“i…

If data = {“item”: “Book”, “qty”: 5} and you execute data[“item”] = “Magazine”, what best describes what happened?

Read Details

Although not explicitly detailed in the notes beyond basic u…

Although not explicitly detailed in the notes beyond basic unpacking, Python supports extended unpacking. If data = (1, 2, 3, 4, 5), what values are assigned in first, *middle, last = data?

Read Details

Given names = [“alice”, “bob”, “charlie”], what does [name.u…

Given names = [“alice”, “bob”, “charlie”], what does [name.upper() for name in names] produce?

Read Details

Which statement accurately describes the requirements for ke…

Which statement accurately describes the requirements for keys in a Python dictionary?

Read Details

Given fruits = [‘apple’, ‘banana’, ‘cherry’], what does {i:…

Given fruits = [‘apple’, ‘banana’, ‘cherry’], what does {i: fruit for i, fruit in enumerate(fruits)} produce?

Read Details

Posts pagination

Newer posts 1 … 27,199 27,200 27,201 27,202 27,203 … 85,135 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top