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 · Gemini, GPT-5.6, Claude · Coding
56Quality
88%Useful
85Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a Python function that takes a list containing fruit names and returns the most common fruit name. ### Input: ['Apple', 'Orange', 'Apple', 'Pineapple', 'Grape', 'Apple'] ### Output: def most_common_fruit(fruit_list): # Dictionary to get count of each fruit freq_dict = {} # Count frequency of each fruit for fruit in fruit_list: if fruit in freq_dict: freq_dict[fruit] += 1 else: freq_dict[fruit] = 1 # Get maximum frequency max_freq = 0 for freq in freq_dict.values(): if freq > max_freq: max_freq = freq # Get the most common fruit most_common_fruit = None for fruit, freq in freq_dict.items(): if freq == max_freq: most_common_fruit = fruit break return most_common_fruit
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