From fce6fc9073bafd5273efc931cc4787d9321237e9 Mon Sep 17 00:00:00 2001 From: DennisEckerskorn Date: Tue, 15 Oct 2024 17:57:18 +0200 Subject: [PATCH] Add ej01 + readme --- ejercicios_hilos/ej01.py | 15 ++++++++++++++- readme.md | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ejercicios_hilos/ej01.py b/ejercicios_hilos/ej01.py index 66632ea..5397ec0 100644 --- a/ejercicios_hilos/ej01.py +++ b/ejercicios_hilos/ej01.py @@ -1 +1,14 @@ -print("test") \ No newline at end of file +import threading + +def Hilo2(): + print ('Soy el hilo 2\n') + t3 = threading.Thread(target=Hilo3) + t3.start() + +def Hilo3(): + print ('Soy el hilo 3 y Ășltimo\n') + +t2 = threading.Thread(target=Hilo2) + +t2.start() +print ("Soy el Hilo 1 y primero\n") \ No newline at end of file diff --git a/readme.md b/readme.md index 3ba7de3..96869fa 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,21 @@ ### Ejercicio01: +``` +import threading + +def Hilo2(): + print ('Soy el hilo 2\n') + t3 = threading.Thread(target=Hilo3) + t3.start() + +def Hilo3(): + print ('Soy el hilo 3 y Ășltimo\n') + +t2 = threading.Thread(target=Hilo2) + +t2.start() +print ("Soy el Hilo 1 y primero\n") +``` ### Ejercicio02: ```