VIP 👤
🏠 Home
Prestatietests
📊 Alle benchmarks 🦖 Dinosaur v1 🦖 Dinosaur v2 ✅ To-Do List applicaties 🎨 Creatieve vrije pagina's 🎯 FSACB - Ultieme showcase 🌍 Vertaalbenchmark
Modellen
🏆 Top 10 modellen 🆓 Gratis modellen 📋 Alle modellen ⚙️ Kilo Code
Bronnen
💬 Promptbibliotheek 📖 AI-woordenlijst 🔗 Nuttige links 🔌 AI-API's en routers
Medium

Refactor Legacy Python Code

#coding #python #optimization

Improve the efficiency and readability of a provided Python code snippet by applying Pythonic idioms.

You are an expert Python developer. Please review the following code snippet. Identify any performance bottlenecks, readability issues, or anti-patterns. Refactor the code to be more efficient using Pythonic idioms, add docstrings where necessary, and explain the changes you made in a list format. Code snippet: def get_primes(n): primes = [] for num in range(2, n + 1): for i in range(2, num): if (num % i) == 0: break else: primes.append(num) return primes