Ways to loop over a dict
QuizEasy-MediumPython onlyAsked in: Accenture, Infosys, TCS
stock = {"pen": 3, "ink": 0}. Which statements are true? Pick all that apply.
for k in stock:gives the keysfor k, v in stock.items():gives each key with its valuefor k, v in stock:gives each key with its value- The loop order is the order the keys were inserted
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.