Advertisement
Kevin071

Untitled

Sep 24th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. const pythonTopics = [
  2. {
  3. id: "basics",
  4. title: "Fundamentos de Python",
  5. subitems: [
  6. {
  7. id: "variables",
  8. title: "Variables",
  9. content: [
  10. {
  11. type: "text",
  12. value:
  13. "Las variables en Python son contenedores para almacenar datos. Se crean asignando un valor:",
  14. },
  15. { type: "code", value: 'x = 5\ny = "Hola, mundo!"\nz = 3.14' },
  16. {
  17. type: "text",
  18. value:
  19. "Python es un lenguaje de tipado dinámico, lo que significa que no necesitas declarar el tipo de una variable explícitamente.",
  20. },
  21. ],
  22. },
  23. {
  24. id: "datatypes",
  25. title: "Tipos de datos",
  26. content: [
  27. {
  28. type: "text",
  29. value: "Python tiene varios tipos de datos integrados:",
  30. },
  31. {
  32. type: "list",
  33. value: [
  34. "int: números enteros",
  35. "float: números decimales",
  36. "str: cadenas de texto",
  37. "list: listas",
  38. "dict: diccionarios",
  39. "bool: valores booleanos",
  40. ],
  41. },
  42. {
  43. type: "image",
  44. value:
  45. "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",
  46. alt: "Diagrama de tipos de datos en Python",
  47. },
  48. ],
  49. },
  50. {
  51. id: "control",
  52. title: "Estructuras de control",
  53. content: [
  54. {
  55. type: "text",
  56. value: "Las estructuras de control en Python incluyen:",
  57. },
  58. {
  59. type: "code",
  60. value:
  61. "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",
  62. },
  63. { type: "text", value: "Los bucles en Python:" },
  64. {
  65. type: "code",
  66. value:
  67. "for item in lista:\n print(item)\n\nwhile condicion:\n # código a repetir",
  68. },
  69. ],
  70. },
  71. ],
  72. },
  73. {
  74. id: "functions",
  75. title: "Funciones",
  76. subitems: [
  77. {
  78. id: "def",
  79. title: "Definición de funciones",
  80. content: [
  81. {
  82. type: "text",
  83. value:
  84. 'Las funciones en Python se definen usando la palabra clave "def":',
  85. },
  86. {
  87. type: "code",
  88. value: 'def saludar(nombre):\n return f"Hola, {nombre}!"',
  89. },
  90. { type: "text", value: "Puedes llamar a la función así:" },
  91. {
  92. type: "code",
  93. value:
  94. 'mensaje = saludar("Alice")\nprint(mensaje) # Imprime: Hola, Alice!',
  95. },
  96. ],
  97. },
  98. {
  99. id: "args",
  100. title: "Argumentos y parámetros",
  101. content: [
  102. {
  103. type: "text",
  104. value: "Las funciones pueden tener diferentes tipos de parámetros:",
  105. },
  106. {
  107. type: "list",
  108. value: [
  109. "Parámetros posicionales",
  110. "Parámetros con valores por defecto",
  111. "Parámetros de longitud variable (*args)",
  112. "Parámetros de palabras clave variables (**kwargs)",
  113. ],
  114. },
  115. {
  116. type: "code",
  117. value:
  118. "def funcion_compleja(a, b=5, *args, **kwargs):\n # Código de la función",
  119. },
  120. ],
  121. },
  122. ],
  123. },
  124. ];
  125.  
  126. export default pythonTopics;
  127.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement