Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const pythonTopics = [
- {
- id: "basics",
- title: "Fundamentos de Python",
- subitems: [
- {
- id: "variables",
- title: "Variables",
- content: [
- {
- type: "text",
- value:
- "Las variables en Python son contenedores para almacenar datos. Se crean asignando un valor:",
- },
- { type: "code", value: 'x = 5\ny = "Hola, mundo!"\nz = 3.14' },
- {
- type: "text",
- value:
- "Python es un lenguaje de tipado dinámico, lo que significa que no necesitas declarar el tipo de una variable explícitamente.",
- },
- ],
- },
- {
- id: "datatypes",
- title: "Tipos de datos",
- content: [
- {
- type: "text",
- value: "Python tiene varios tipos de datos integrados:",
- },
- {
- type: "list",
- value: [
- "int: números enteros",
- "float: números decimales",
- "str: cadenas de texto",
- "list: listas",
- "dict: diccionarios",
- "bool: valores booleanos",
- ],
- },
- {
- type: "image",
- value:
- "https://www.shutterstock.com/shutterstock/photos/1912904167/display_1500/stock-photo-giant-moa-bird-dinornithiformes-realistic-drawing-illustration-for-the-encyclopedia-of-ancient-1912904167.jpg",
- alt: "Diagrama de tipos de datos en Python",
- },
- ],
- },
- {
- id: "control",
- title: "Estructuras de control",
- content: [
- {
- type: "text",
- value: "Las estructuras de control en Python incluyen:",
- },
- {
- type: "code",
- value:
- "if condicion:\n # código si es verdadero\nelif otra_condicion:\n # código si la primera es falsa y esta es verdadera\nelse:\n # código si todas las condiciones son falsas",
- },
- { type: "text", value: "Los bucles en Python:" },
- {
- type: "code",
- value:
- "for item in lista:\n print(item)\n\nwhile condicion:\n # código a repetir",
- },
- ],
- },
- ],
- },
- {
- id: "functions",
- title: "Funciones",
- subitems: [
- {
- id: "def",
- title: "Definición de funciones",
- content: [
- {
- type: "text",
- value:
- 'Las funciones en Python se definen usando la palabra clave "def":',
- },
- {
- type: "code",
- value: 'def saludar(nombre):\n return f"Hola, {nombre}!"',
- },
- { type: "text", value: "Puedes llamar a la función así:" },
- {
- type: "code",
- value:
- 'mensaje = saludar("Alice")\nprint(mensaje) # Imprime: Hola, Alice!',
- },
- ],
- },
- {
- id: "args",
- title: "Argumentos y parámetros",
- content: [
- {
- type: "text",
- value: "Las funciones pueden tener diferentes tipos de parámetros:",
- },
- {
- type: "list",
- value: [
- "Parámetros posicionales",
- "Parámetros con valores por defecto",
- "Parámetros de longitud variable (*args)",
- "Parámetros de palabras clave variables (**kwargs)",
- ],
- },
- {
- type: "code",
- value:
- "def funcion_compleja(a, b=5, *args, **kwargs):\n # Código de la función",
- },
- ],
- },
- ],
- },
- ];
- export default pythonTopics;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement