Group a list by a function
Write a Python program to group the elements of a list by the result of a function such as `len`. Step-by-step explanation, colour-coded code and real output.
Online Learning Platform
Free tutorials, solved practice problems and interview prep for QA and automation engineers: Python, Playwright, Selenium, SQL, Git and more.
Write a Python program to group the elements of a list by the result of a function such as `len`. Step-by-step explanation, colour-coded code and real output.
Write a Python program to count the number of keys and the total characters in them. Step-by-step explanation, colour-coded code and real output.
Write a Python program to turn {key: [value]} into one dictionary per combination. Step-by-step explanation, colour-coded code and real output.
Write a Python program to count how often each value appears in a dictionary. Step-by-step explanation, colour-coded code and real output.
Write a Python program to find the keys whose list values are the shortest. Step-by-step explanation, colour-coded code and real output.
Write a Python program to find the keys of the two largest values. Step-by-step explanation, colour-coded code and real output.
Write a Python program to keep only even numbers in each list value. Step-by-step explanation, colour-coded code and real output.
Write a Python program to print the keys of a dictionary, capitalised. Step-by-step explanation, colour-coded code and real output.
Write a Python program to remove entries whose value contains any of the given substrings. Step-by-step explanation, colour-coded code and real output.
Write a Python program to remove keys whose values are greater than n. Step-by-step explanation, colour-coded code and real output.
Write a Python program to get the values of dictionary keys that are also in a list. Step-by-step explanation, colour-coded code and real output.
Write a Python program to nest each item of a dictionary under a key from a list. Step-by-step explanation, colour-coded code and real output.
Take free timed mock tests with answers and explanations.