Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
I'm back. had this tab up for like 2 weeks. I was working OT and picking up shifts at my second job. I quit one of em tho so back to the study grind!! Gotta get myself in a better position in life, no one else is gonna do the work for me!
Hey Dhaval I m watching u from long time just commenting here to let u know how awsm your content is your efforts money u put is worth a every single penny ! God bless you
this is really good.. thankyou so much sir. Also, i have a request, please include more questions in the excercises in future videos as then the topic becomes very clear!..
Dear Sir, Your approach to teaching is really amazing. You open the underlying core knowledge, which will help to understand the subject very well. Meanwhile, your guide to search the internet to gather more information is really worthwhile. So we can add more and more flesh on to the skeleton you develop in us. I started to follow your Data Science Series two weeks ago. Now I am going through it for the second time while doing all the exercises. Being medical personnel, I really started loving Data Science because of your superb explanations and encouragement!! I believe your video series will do invaluable service to the Data Science field. Please continue your great job. Your service is needed more than ever for the Data Science world. You can squeeze out the palatability of the subject for the people who are craving for knowledge. Thank you so much.
Nilupul, thanks for your kind words of appreciation and detailed feedback :) Comments like this gives me motivation to continue my work. Thanks again and I wish you all the best :)
Can you tell me where you "copy and paste" the class from? I'm trying to document all my practice and I want to make sure to make a proper reference! Thanks for the great videos. I'm learning a lot from you. BTW, I've read elsewhere that some people will pronounce deque like "deck," to differentiate from dequeue.
Aaron, what I do is I prepare the code in advance and while doing UA-cam recording I start with blank and copy paste my own code. So all my content is my own genuine hard work. I spend lot of time in preparing this content. It is 100% genuinely my own content so please give a reference to codebasics youtube channel. If you want to put my name than it's Dhaval Patel
Hello Sir, Could you make video on recursion and its application. Besides, i really appreciate sharing your tutorial videos they are really helpful. If you can also make it in Hindi for your hindi channel , it would be awesome ☺️
As I know you are the only saviour on web, who replies very fast with some effective suggestions my bunch of questions are below Hi Sir, I have a question obviously not related to this video....Is that Data Gathering from web or anywhere else also comes under a Data Analyst responsibility?? If yes then , Can I collect it using Python through api links?? If yes then from where can I get the api links of any social media? Is it doable.....or am I asking a correct questions?? I'm totally confused.....please help.
Your questions are very valid prasanta. Often data collection is done by data analyst but not all the times. Sometimes companies already have huge collection of data that is owned by different engineering and infrastructure teams. Business analysts also help with data collection process. People use data scrapping tools such as web crawlers to crawl internet for data collection. You can read about python scrapy library which is used for this purpose. However remember that no website would like you to crawl their portal in automated way hence many times the question arises if it is even legal to crawl web. So really there is no good or easy way to collect data from internet. There are portals like quandl or kaggle that provide datasets. I work for Bloomberg and we have api product where you pay a price and get financial data in form of feed through excel etc.
@@codebasics Thank You for your reply Sir,...So I can say data scraping is in ...grey part.... but if I want to collect some reaction of users from social media or any online shopping websites....Suppose I want to get the comments of facebook or instagram users for a particular post to get peoples thoughts about that post. so, can I also call it data scrapping ? Is it also in a grey part? If it is legal..then Is it possible to collect those comments data by any scrapping tools? if yes then can I use any algorithm on those word datas converting them into numerical data , like how we get insights from twitter comments though data mining?
do we need circular queue if we implement queue this way in python? What I mean is since deque/list is dynamic and we are appending at the left, so no issues of running out of capacity per se. Thoughts?
sir, you are awesome because your teaching style is also good and your video tutorial for python is really good sirrr plz you also make the another main concept of python and python algorithms...
Just one thing to notify here, Example Yahoo and Google finance can not use same dequeue method, as only the first who access will get correct result than it will remove (pop) from queue
Thank you so much. I have taken a Data Structure course before but it was taught in Java. Your videos are so helpful in implementing it in python. I am confused at what does ".buffer" do?
Did you do thread.join? In my python tutorials series I have multithreading tutorial please watch that so that you get an idea. Also I have a solution link in exercise page so please refer to that
do this it will stop: def serve_orders(): time.sleep(1) while food_order_queue.size() != 0: order = food_order_queue.dequeue() print("Now serving: ",order) time.sleep(2)
Hello sir, Can you please tell me..if this is the right way to do 2nd ques or not?if __name__ == "__main__": q = Queue() numbers = int(input("Enter numbers:")) for i in range(1,numbers+1): q.enqueue((bin(i).replace("0b",""))) print(q.dequeue())
Class implemented will again have the issues same as the list explained earlier. We can add another check in the dqueue method to check if the queue is empty or not.
hello sir, I'm really confused. I'm in my final year of engineering and I want to be a Data Scientist but I also want to keep Software Developer as a backup option. The problem is I'm only good at python. So do I need to learn a new language like Java or C++ or can I give SDE interviews with just python?
@@randyorton4435 yes i have been placed in 3 companies out of which 2 as a junior data scientist (both via ppo from internship)..All are based on Python only.. i still don't know any other languages
I am going to upload few videos on tree, graph and also few more videos comparing different data structures. I dont have exact count but atleast 5 more videos.
your code for example 1 ....food_ordering_system.py should be having infinite loop while serving item. There are no checks on whether order queue is empty
Yes, precisely. Either Make And If Statement Stating If food_order_queue.is_empty() break Something Like This In server_order So When There Is No More Order It Should Stop Or Wait For More Orders.
Update function server_orders() by below function, to get rid of unwanted infinite process. def serve_orders(): time.sleep(1) while True: order = food_order_queue.dequeue() if order: print("Now serving: ",order) time.sleep(2) else: return False
Insert and pop are methods specific for a Stack not a Queue, a queue usually has methods like enqueue or dequeue so I am not sure why you are referring to a list as a queue.
Hey Buddy...If you understand correctly he's showing "how to create a Queue using a list", you can create a queue using a List or already available deque from collections or using a LinkedList(which again U can create). The methods "Insert" and "Pop" are built-in methods available for Python lists, similarly there are methods available for deque. The objective of the videos is to teach Data Structures and then implement with Python.
sir, in list if we append new element it reallocate the memory and copy so list is not recommended but what do a queue do if a new element is appended???...how does it manage the memory?
hi..actually I got an project to make using machine learning but I don't know how to start and what to do and where to get data from as I haven't looked into this kind of thing ...so kindly guide me with the project : crawl popular websites and create a database of Indian movie celebrities with their images and personality traits
I have not prepared all videos. I am adding them as and when I get time to prepare them but yes I am trying my best. Next one is going to be on a tree.
isn't it obvious, because queue behaves like a linked list, if you want to access a specific element in the queue, you can access it when its turn comes. Think like you are in a queue, how they access you if your turn does not comes. But thin you are in a room with a number written on your chest. When they call your number, they immediately reach you
def rem(i): s=Queue() for n in range(1,i+1): z="" while n>0: a=n%2 z+=str(a) n=n//2 s.enqueue(z[::-1]) c=len(s.buffer) while c>0: print(s.buffer[c-1]) c-=1 print(rem(10))
can u teach us how to predict the next lottery or prize bonds numbers sequences with IA , using import requests from bs4 import BeautifulSoup as bs import threading import queue python
@Optimal Rider I implemented it in my own way using "front" as a variable which will store the dequeue and inside the loop, append "0" with front first then "1" print front and then print newline inside the loop. Even simpler and easy to understand logic than the Solution. Also I modified dequeue to do a pop(0)rather than pop. always better to implement any solution in your own way(that's the best way of determining your understanding). Do you still need help to understand the solution code?
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
I'm back. had this tab up for like 2 weeks. I was working OT and picking up shifts at my second job. I quit one of em tho so back to the study grind!! Gotta get myself in a better position in life, no one else is gonna do the work for me!
Hope you're doing well, it ain't fuckin easy.
@@TheDoc-Worker Ye lmao
please dont waste your time with watching Udemy courses. This gentleman teach everything you image about python.
For those of you wondering why queue has O(1) inserting and deleting item, it is because queue is usually implemented using doubly linked list.
Hey Dhaval I m watching u from long time just commenting here to let u know how awsm your content is your efforts money u put is worth a every single penny ! God bless you
I am happy this was helpful to you.
this is really good.. thankyou so much sir.
Also, i have a request, please include more questions in the excercises in future videos as then the topic becomes very clear!..
Thanks for proving the exercises, they are really helpful.
Glad you like them!
Great tutorial. I love your channel! Thanks for creating these amazing tutorials.
Agree with Omkar.... What a simple and magnificent exercise to use the data structure.
Just brilliant again....:)
Thanks again!
Great lecture. I appreciate the upload.
Add this line to stop Empty queue loop:
def ServeOrder(orders):
time.sleep(1)
while True:
if food_order.isempty():
print("All items Served")
break
order = food_order.dequeue()
print("Serving order: ",order)
time.sleep(2)
Also may be replace the while condition to check food_order_queue.size() !=0
Bro i tested out the same code as in the solution but it gives me random results like first order the second order then after serve
Dear Sir,
Your approach to teaching is really amazing. You open the underlying core knowledge, which will help to understand the subject very well. Meanwhile, your guide to search the internet to gather more information is really worthwhile. So we can add more and more flesh on to the skeleton you develop in us.
I started to follow your Data Science Series two weeks ago. Now I am going through it for the second time while doing all the exercises.
Being medical personnel, I really started loving Data Science because of your superb explanations and encouragement!!
I believe your video series will do invaluable service to the Data Science field.
Please continue your great job. Your service is needed more than ever for the Data Science world.
You can squeeze out the palatability of the subject for the people who are craving for knowledge.
Thank you so much.
Nilupul, thanks for your kind words of appreciation and detailed feedback :) Comments like this gives me motivation to continue my work. Thanks again and I wish you all the best :)
@@codebasics Sir you are Genius, How can i become genius like you?
Sir you are doing very well...you are my best teacher for data science and machine learning..😃😃😃 looking for more videos on this...
I will try my best
oh god my laptop is too heated. next time upload video on how to cool it...
jokin. really the best tutorial and easy way to understand . thank you
whoa. deque is double ended queue.
Used deque for so long but never noticed.
Can you tell me where you "copy and paste" the class from? I'm trying to document all my practice and I want to make sure to make a proper reference! Thanks for the great videos. I'm learning a lot from you.
BTW, I've read elsewhere that some people will pronounce deque like "deck," to differentiate from dequeue.
Aaron, what I do is I prepare the code in advance and while doing UA-cam recording I start with blank and copy paste my own code. So all my content is my own genuine hard work. I spend lot of time in preparing this content. It is 100% genuinely my own content so please give a reference to codebasics youtube channel. If you want to put my name than it's Dhaval Patel
Hello Sir,
Could you make video on recursion and its application.
Besides, i really appreciate sharing your tutorial videos they are really helpful. If you can also make it in Hindi for your hindi channel , it would be awesome ☺️
Sure, i will cover a topic of recursion. I've codebasics hindi channel as well, it has few tutorials on python and machine learning. check that out.
Amazing exercise questions
☺️👍
As I know you are the only saviour on web, who replies very fast with some effective suggestions my bunch of questions are below
Hi Sir, I have a question obviously not related to this video....Is that Data Gathering from web or anywhere else also comes under a Data Analyst responsibility?? If yes then , Can I collect it using Python through api links??
If yes then from where can I get the api links of any social media?
Is it doable.....or am I asking a correct questions??
I'm totally confused.....please help.
Your questions are very valid prasanta. Often data collection is done by data analyst but not all the times. Sometimes companies already have huge collection of data that is owned by different engineering and infrastructure teams. Business analysts also help with data collection process. People use data scrapping tools such as web crawlers to crawl internet for data collection. You can read about python scrapy library which is used for this purpose. However remember that no website would like you to crawl their portal in automated way hence many times the question arises if it is even legal to crawl web. So really there is no good or easy way to collect data from internet. There are portals like quandl or kaggle that provide datasets. I work for Bloomberg and we have api product where you pay a price and get financial data in form of feed through excel etc.
@@codebasics Thank You for your reply Sir,...So I can say data scraping is in ...grey part....
but if I want to collect some reaction of users from social media or any online shopping websites....Suppose
I want to get the comments of facebook or instagram users for a particular post to get peoples thoughts about that post.
so, can I also call it data scrapping ?
Is it also in a grey part?
If it is legal..then Is it possible to collect those comments data by any scrapping tools?
if yes then can I use any algorithm on those word datas converting them into numerical data , like how we get insights from twitter comments though data mining?
Can you please explain why did we use self.container in stack and self.buffer while implementing queue? What is their significance?
there is no difference. those are just two different variable names :)
@@codebasics got it..
thanks for knowledge ,i realy appriciate
Sir the problems are amazing
good example for queue.
do we need circular queue if we implement queue this way in python? What I mean is since deque/list is dynamic and we are appending at the left, so no issues of running out of capacity per se. Thoughts?
sir, you are awesome because your teaching style is also good and your video tutorial for python is really good sirrr plz you also make the another main concept of python and python algorithms...
Wow! Enjoy the sense of humor in your tutorial very much. Thanks
Just one thing to notify here, Example Yahoo and Google finance can not use same dequeue method, as only the first who access will get correct result than it will remove (pop) from queue
Thank you so much. I have taken a Data Structure course before but it was taught in Java. Your videos are so helpful in implementing it in python. I am confused at what does ".buffer" do?
that was just an instance of deque() created in calling properties of the class. self.buffer = deque() see the 4th line of code 10:21
Thank you so much, It's so useful for me
Glad it was helpful!
great work sir
Where can I learn more about software infastructure mentioned at the beginning of the video
5:12 In C++ pop() returns void i.e. it only removes the front without returning anything...
you are using a different compiler.he's using jupter notebook that's why he is getting it as output
Can you tell me how come pq.buffer print the values
Amazing sir...Thank you so much. I have doubt that in Order code(exercise) Thread is not stopped after all orders are over..What I have to do now??
Did you do thread.join? In my python tutorials series I have multithreading tutorial please watch that so that you get an idea. Also I have a solution link in exercise page so please refer to that
@@codebasics ok sir...Thank you
do this it will stop:
def serve_orders():
time.sleep(1)
while food_order_queue.size() != 0:
order = food_order_queue.dequeue()
print("Now serving: ",order)
time.sleep(2)
Hello sir, Can you please tell me..if this is the right way to do 2nd ques or not?if __name__ == "__main__":
q = Queue()
numbers = int(input("Enter numbers:"))
for i in range(1,numbers+1):
q.enqueue((bin(i).replace("0b","")))
print(q.dequeue())
Dear sir could you please make some videos on algorithms ......which are important for product-based companies placement??
thank you sir...
Class implemented will again have the issues same as the list explained earlier. We can add another check in the dqueue method to check if the queue is empty or not.
is there any need for appendleft, we can do it with append and we can remove the first index of the list
sir but i performed queue using list in python and its working well.
sir is this all 11 videos are covered the whole data structure in python or not and sir, plz make a tutorial on algorithms also
Hello Sir, can you please create a video developing of project using only DSA ?
Thank you dhaval sir
hello sir,
I'm really confused. I'm in my final year of engineering and I want to be a Data Scientist but I also want to keep Software Developer as a backup option. The problem is I'm only good at python. So do I need to learn a new language like Java or C++ or can I give SDE interviews with just python?
just python is good.
@@codebasics Thank-you sir!
@@daivikbhatia5041with the only help of python have your get placed now??
@@randyorton4435 yes i have been placed in 3 companies out of which 2 as a junior data scientist (both via ppo from internship)..All are based on Python only.. i still don't know any other languages
@@daivikbhatia5041 should we learn DSA for data analyst roles.
Thank you...
love the details apart from Queue.. knowledge is beautiful
Thanks sir , Sir how many videos are left in this playlist
I am going to upload few videos on tree, graph and also few more videos comparing different data structures. I dont have exact count but atleast 5 more videos.
your code for example 1 ....food_ordering_system.py should be having infinite loop while serving item. There are no checks on whether order queue is empty
Yes, precisely.
Either Make And If Statement Stating
If food_order_queue.is_empty()
break
Something Like This In server_order
So When There Is No More Order It Should Stop Or Wait For More Orders.
If You Know The Correct Solution Please Let Us Know.
Good day, Please how will you break the code? It keeps printing even after queue is empty?
Update function server_orders() by below function, to get rid of unwanted infinite process.
def serve_orders():
time.sleep(1)
while True:
order = food_order_queue.dequeue()
if order:
print("Now serving: ",order)
time.sleep(2)
else:
return False
Insert and pop are methods specific for a Stack not a Queue, a queue usually has methods like enqueue or dequeue so I am not sure why you are referring to a list as a queue.
Hey Buddy...If you understand correctly he's showing "how to create a Queue using a list", you can create a queue using a List or already available deque from collections or using a LinkedList(which again U can create). The methods "Insert" and "Pop" are built-in methods available for Python lists, similarly there are methods available for deque.
The objective of the videos is to teach Data Structures and then implement with Python.
sir, in list if we append new element it reallocate the memory and copy so list is not recommended but what do a queue do if a new element is appended???...how does it manage the memory?
There are multiple ways of implementing a queue but if you use linked list it will be better because you don't have to worry about shifting elements
Does every API use queue data structure?
why does my jupyter notebook throws this error?--------- descriptor 'appendleft' for 'collections.deque' objects doesn't apply to a 'int' object
How will u define loose and strong coupling?
hey there's an error in the order placing code, replace True in line 37 with not food_order_queue.is_empty():
My computer needs a PCR test kit
in 4:43 explanation picture is incorrect
Sir my laptop has 100 and 5 degree fever what should I do 😅
hi..actually I got an project to make using machine learning but I don't know how to start and what to do and where to get data from as I haven't looked into this kind of thing ...so kindly guide me with the project : crawl popular websites and create a database of Indian movie celebrities with their images and personality traits
Vandana, can you send me your entire project description and some more details on learnpythonlanguage@gmail.com? We can discuss more on email.
@@codebasics I had emailed you . please do check
the code u provided in the solution it is coming a non ending loop of none and serve orders how to fix that
1. question
Hiii Sir. Can you please upload these series videos fast.
I have not prepared all videos. I am adding them as and when I get time to prepare them but yes I am trying my best. Next one is going to be on a tree.
from collections import deque
import time
import threading
class Queue :
def __init__(self):
self.buffer = deque()
def pop():
return self.buffer.pop()
def enqueue(self , val):
self.buffer.appendleft(val)
def dequeue(self):
return self.buffer.pop()
def is_empty(self):
return len(self.buffer) == 0
def size(self):
return len(self.buffer)
def place_order(li ,q):
for each in li :
print("Placing order for:",each)
q.enqueue(each)
time.sleep(.5)
def serve_order(q) :
time.sleep(1)
# this condition is bz , time_enqueue() < time_deque()
while not q.is_empty() :
print("Enjoy the served order : " + q.dequeue())
time.sleep(2)
if __name__ == "__main__" :
li = ['pizza','samosa','pasta','biryani','burger','litti-chokha','dal-wada','mendu-wada']
q = Queue()
t = time.time()
t1 = threading.Thread(target = place_order , args = (li , q,))
t2 = threading.Thread(target = serve_order , args=(q,))
t1.start()
t2.start()
t1.join()
t2.join()
print("Total time taken(for comparision) : " + str(time.time() - t))
More better
Great.thabks for working in exercise 👍😊
why queue has different time complexity than array??
isn't it obvious, because queue behaves like a linked list, if you want to access a specific element in the queue, you can access it when its turn comes. Think like you are in a queue, how they access you if your turn does not comes. But thin you are in a room with a number written on your chest. When they call your number, they immediately reach you
@@muhammedcanozdemir6447 how is array different in terms of access?
TIME COMPLEXITY?
from collections import deque
class Queue:
def __init__(self):
self.buffer=deque()
def enqueue(self,val):
self.buffer.appendleft(val)
def dequeue(self):
return self.buffer.pop()
def front(self):
return self.buffer[-1]
def is_empty(self):
return len(self.buffer)==0
def size(self):
return len(self.buffer)
def rem(i):
s=Queue()
for n in range(1,i+1):
z=""
while n>0:
a=n%2
z+=str(a)
n=n//2
s.enqueue(z[::-1])
c=len(s.buffer)
while c>0:
print(s.buffer[c-1])
c-=1
print(rem(10))
Hello Sir,
can you give a data structure in a different programming language slide
Thx.
can u teach us how to predict the next lottery or prize bonds numbers sequences with IA , using import requests
from bs4 import BeautifulSoup as bs
import threading
import queue
python
Can Anyone Help Me With Question 2 in Exercise, Not Able To Understand The Logic Even After Checking Out The Solution.
It Would Be Great Help!
@Optimal Rider I implemented it in my own way using "front" as a variable which will store the dequeue and inside the loop, append "0" with front first then "1" print front and then print newline inside the loop. Even simpler and easy to understand logic than the Solution. Also I modified dequeue to do a pop(0)rather than pop. always better to implement any solution in your own way(that's the best way of determining your understanding). Do you still need help to understand the solution code?
Is your forst problem worked perfectly
sir mere computer mai COVID 19 aagya hai sir kya kru vaccination kam nhi ayi kya kru 😰
why do we use this in code:
if __name__ == '__main__':
basically for the scenario if the script is not being exported and is executed directly.
Ohhh no! I got COVID-19 virus in my computer!!!!!!😱😱😱
Multi threading required for exercise. So use below link to understand.
ua-cam.com/video/GqHLztqy0PU/v-deo.html
why do i feel like this is to easy to be true
right, no mention of ciruclar queue here
Thank you so much ... may Allah guide you to accept Islam 😊
Oops I accidentally clicked solution and my computer got covid 19 virus 😢
🤣🤣🤣Covid-19 virus
Thank you sir......for making such kind of videos which is veey helpful for us.
It's my pleasure