Saltar al contenido principal
🔒 Modo vista previa. Las primeras quince lecciones de Foundations son gratis; esta es Pro. Inicia un trial de 7 días para desbloquear el editor, las pistas AI y el resto del programa. Tarjeta requerida, cancela cuando quieras en Dashboard.Iniciar trial de 7 días →
← CursosPython FoundationsMódulo 8 · Python moderno y capstonefunctools.singledispatch - despacho basado en tiposwrite161 / 174
+100 XP
Tarea🌐 shown in EN
📝 **Question:** Build a \`length(x)\` using \`@singledispatch\` that returns:\n- for str: \`len(x) * 2\`\n- default (any other type): \`-1\`\nPrint \`length("hi")\` and \`length(42)\`.\nExpected:\n4\n-1 📋 Pick the right answer. 💡 **Hint:** Re-read the theory above if unsure.
✏️ Escribe tu código aquí
🐍
Cargando Python...
Descarga única (~1 MB). Después, es instantáneo.
📊 Resultado
Pulsa Ejecutar para ver el resultado...