diff --git a/ejercicios_hilos/ej04/ej04.py b/ejercicios_hilos/ej04/ej04.py
new file mode 100644
index 0000000..7c08ebf
--- /dev/null
+++ b/ejercicios_hilos/ej04/ej04.py
@@ -0,0 +1,9 @@
+def escribir_en_fichero(variable):
+ with open('resources/salida.txt', 'w') as archivo:
+ archivo.write(f"El valor de la variable es: {variable}\n")
+ print("El valor ha sido escrito en el fichero 'salida.txt'.")
+
+
+mi_variable = 42
+
+escribir_en_fichero(mi_variable)
\ No newline at end of file
diff --git a/ejercicios_hilos/ej04/html_examples/1.html b/ejercicios_hilos/ej04/html_examples/1.html
new file mode 100644
index 0000000..a818cc2
--- /dev/null
+++ b/ejercicios_hilos/ej04/html_examples/1.html
@@ -0,0 +1,11 @@
+
+
+
+ Página 1
+
+
+ Ir a página 2
+
+ Volver
+
+
\ No newline at end of file
diff --git a/ejercicios_hilos/ej04/html_examples/2.html b/ejercicios_hilos/ej04/html_examples/2.html
new file mode 100644
index 0000000..0635933
--- /dev/null
+++ b/ejercicios_hilos/ej04/html_examples/2.html
@@ -0,0 +1,11 @@
+
+
+
+ Página 2
+
+
+ Ir a página 1
+
+ Volver
+
+
\ No newline at end of file
diff --git a/ejercicios_hilos/ej04/html_examples/index.html b/ejercicios_hilos/ej04/html_examples/index.html
new file mode 100644
index 0000000..cf1c6dd
--- /dev/null
+++ b/ejercicios_hilos/ej04/html_examples/index.html
@@ -0,0 +1,9 @@
+
+
+
+ Inicio
+
+
+ Ir a página 1
+
+
\ No newline at end of file
diff --git a/resources/salida.txt b/resources/salida.txt
new file mode 100644
index 0000000..e138256
--- /dev/null
+++ b/resources/salida.txt
@@ -0,0 +1 @@
+El valor de la variable es: 42