BestPromptFinder
HomeCoding › Below is an instruction that describes a task. Write a respo...

Below is an instruction that describes a task. Write a respo...

Coding · General · Coding
63Quality
88%Useful
85Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Write a function in Python to sort a dictionary according to its values, in descending order. ### Input: dictionary = {'apple': 2, 'banana': 3, 'mango': 1} ### Output: def sortDictionary(dictionary): sorted_list = sorted(dictionary.items(), key=lambda x: x[1], reverse=True) sorted_dictionary = dict(sorted_list) return sorted_dictionary sorted_dictionary = sortDictionary({'apple': 2, 'banana': 3, 'mango': 1}) print(sorted_dictionary)
Find similar in the app →

Why this prompt

Source

Hugging Face

Related Coding prompts

PRD to MVP Technical Plan
Quality 93 · Claude Code
Full-Stack CRUD App Builder
Quality 93 · Claude Code
Legacy Refactor Planner
Quality 93 · Claude Code
Test Suite Generator
Quality 93 · Claude Code
Third-Party API Integration
Quality 93 · Claude Code
Database Schema and Migration
Quality 93 · Claude Code