🏠 Beranda
Benchmark
📊 Semua Benchmark 🦖 Dinosaurus v1 🦖 Dinosaurus v2 ✅ Aplikasi To-Do List 🎨 Halaman Bebas Kreatif 🎯 FSACB - Showcase Utama 🌍 Benchmark Terjemahan
Model
🏆 Top 10 Model 🆓 Model Gratis 📋 Semua Model ⚙️ Kilo Code
Sumber Daya
💬 Perpustakaan Prompt 📖 Glosarium AI 🔗 Tautan Berguna
Medium

Identify Logic Error in Python

#debugging #python #code

Find and explain the logic error in a specific code snippet.

Analyze the following Python function that is supposed to return the factorial of a number but is currently entering an infinite loop for inputs greater than 1. Explain why the recursion fails and provide the corrected code snippet: def factorial(n): result = 1 while n > 1: result = result * n return result