# multithreading = Used to perform multiple tasks concurrently (multitasking) # Good for I/O bound tasks like reading files or fetching data from APIs import threading import time def walk_dog(first, last): time.sleep(8) print(f"You finish walking {first} {last}") def take_out_trash(): time.sleep(2) print("You take out the trash") def get_mail(): time.sleep(4) print("You get the mail") chore1 = threading.Thread(target=walk_dog, args=("Scooby", "Doo")) chore1.start() chore2 = threading.Thread(target=take_out_trash) chore2.start() chore3 = threading.Thread(target=get_mail) chore3.start() # .join() ensures that all tasks are completed before proceeding chore1.join() chore2.join() chore3.join() print("All chores are complete!")
Almost at 2 Million! 🎉 I have watched your HTML/CSS course and I learned in about 4 days. I am now making websites for people and they are amazed by them. I am also learning C++ and it is going well because of you. Thank you for opening up this possible future for me and making my dreams come true! Thank you Bro!
Hey man I have a question I am 20 years old I feel like I would be going in way to late into the industry of engineering so would like some advice if you could, if you were to restart how would you do it with todays economy would you still look for a bootcamp and go with that or go a different route, like for me I was thinking I could go to college for 2 years as an engineer which would be an associates just to build the resume and after that go into a bootcamp
What about multi-threading in multi-core CPU systems? In the case of multi-core CPU systems, multiple threads can run their tasks parallelly. Is that Python not capable enough to run multiple tasks parallelly?
# multithreading = Used to perform multiple tasks concurrently (multitasking)
# Good for I/O bound tasks like reading files or fetching data from APIs
import threading
import time
def walk_dog(first, last):
time.sleep(8)
print(f"You finish walking {first} {last}")
def take_out_trash():
time.sleep(2)
print("You take out the trash")
def get_mail():
time.sleep(4)
print("You get the mail")
chore1 = threading.Thread(target=walk_dog, args=("Scooby", "Doo"))
chore1.start()
chore2 = threading.Thread(target=take_out_trash)
chore2.start()
chore3 = threading.Thread(target=get_mail)
chore3.start()
# .join() ensures that all tasks are completed before proceeding
chore1.join()
chore2.join()
chore3.join()
print("All chores are complete!")
bro taught me in 8 minutes what a year of school could not 🗿
LMAOOOOO SAME DUDE
what school did you go to bro?
Almost at 2 Million! 🎉 I have watched your HTML/CSS course and I learned in about 4 days. I am now making websites for people and they are amazed by them. I am also learning C++ and it is going well because of you. Thank you for opening up this possible future for me and making my dreams come true! Thank you Bro!
The way that you explain is awesome🤩
The best video for threading. Thank you 👍
Great explanation & demo. I wish this was available when I first learned threading.
Thank you! I was having trouble understanding this but you made it so easy👍
Very well presented! Thank you.
Thanks for the video
Great explanation
Exactly what I needed!
hello chad ,
please make tutorials on data structure and algorithms in c++ ,
Great Bro.
It would be great help if you could make a tutorial on regular expression as well.
Thanks a lot ...can you also make a tutorial on python asynchronous programming
Very nice Bro Code youre truly a bro. ascynio???
could you please create a multiprocessing like i/o and cpu operation in python parallelly
Please make full course about Rust 🙏
Bro can you please use ui with a pop out color to see clearly
Bro can you please a make video on python daemon threads please...
What laptop do you use for it?
Whats the difference between async and threadin
I always wondered Y can't I just pass args
Turns out it needs to be represented as tuple
Thanks now I don't need to create wrapper functions, 🙃🙃
I'm very interested if you could make an AI course 😊😇
Hey man I have a question I am 20 years old I feel like I would be going in way to late into the industry of engineering so would like some advice if you could, if you were to restart how would you do it with todays economy would you still look for a bootcamp and go with that or go a different route, like for me I was thinking I could go to college for 2 years as an engineer which would be an associates just to build the resume and after that go into a bootcamp
Or do any of yall recommend a bootcamp? Please I would love to know
What about multi-threading in multi-core CPU systems? In the case of multi-core CPU systems, multiple threads can run their tasks parallelly. Is that Python not capable enough to run multiple tasks parallelly?
i get error of no attribute 'Thread'(most likely due to a circular import) any help?
hii bro
dud, ffs please carry my unborn children! Thank You so much :D