Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 2.68 KB

File metadata and controls

76 lines (61 loc) · 2.68 KB

Python Dictionary: Complete Guide

Welcome to the Python Dictionary reference! This README answers frequently asked questions, provides technical and programming exercises (especially on Lists), and helps you maximize this repository.


Common Questions (20)

  1. What is a dictionary in Python?
  2. How do you create a dictionary?
  3. What is the difference between a list and a dictionary?
  4. How do you access values in a dictionary?
  5. How do you add or update key-value pairs?
  6. What happens if you try to access a missing key?
  7. How do you safely access a key that might not exist?
  8. How do you remove a key-value pair from a dictionary?
  9. How do you iterate over keys and values?
  10. How do you merge two dictionaries?
  11. What is a dictionary comprehension?
  12. How do you copy a dictionary?
  13. How do you check if a key exists?
  14. What are dictionary views (keys(), values(), items())?
  15. Are dictionaries ordered?
  16. Can dictionary keys be mutable?
  17. How do you clear a dictionary?
  18. How do you get the number of items in a dictionary?
  19. How do you use default values with get()?
  20. How do you create a nested dictionary?

Technical Questions on Lists (10)

  1. What is the difference between a list and a tuple?
  2. How do you append an element to a list?
  3. How do you remove an element from a list?
  4. How do you slice a list?
  5. How do you concatenate lists?
  6. How do you check membership in a list?
  7. How do you find the index of an element?
  8. How do you reverse a list?
  9. How do you sort a list (ascending/descending)?
  10. What is list comprehension?

Programming Questions with Lists (10)

  1. Write a program to find the largest/smallest element in a list.
  2. Write a program to remove duplicates from a list.
  3. Count the number of occurrences of each element in a list.
  4. Find the sum and average of all elements in a list.
  5. Merge two lists into a single list.
  6. Check if two lists have any elements in common.
  7. Flatten a nested list structure.
  8. Split a list into even and odd numbers.
  9. Reverse the order of a list in-place.
  10. Rotate a list by k steps.

How to Use This Repository

  • For Learners:
    • Study the provided questions as quick interview prep or concept revision.
    • Practice answering the programming exercises to improve coding skills.
    • Use the technical questions to deepen understanding of lists and their use in Python.
  • For Interviewers:
    • Select questions for technical interviews or coding assignments.
  • For Contributors:
    • Add more questions or sample code snippets as pull requests.
    • Improve explanations, solutions, or provide real-world examples.

Stay tuned for solutions and code examples!