Python fundamentals for Data Science - Part 2 Dictionaries | Conditionals | Loops | Functions

Harshit Tyagi · Intermediate ·🛡️ AI Safety & Ethics ·6y ago

Key Takeaways

This video covers Python fundamentals for Data Science, including 2D lists, dictionaries, conditional statements, loops, and functions, using tools like Python and Jupyter Notebook.

Full Transcript

hello everyone welcome to the channel data science with her ship my name is Hershey Chiaki I'm a data science instructor and mentor so this is the second part of the Python fundamentals series in the previous video we covered the basic data types as well as some operations that we can perform on them and we covered Python lists as well so in this particular part we are going to focus on two realist tuples how to write conditional as well as use logical operators and we're going to learn how to write loops as well as what is a proper method to write functions in Python so path and fundamentals part 2 coming right up [Music] so we have our Jabra notebook running and you can head over to the browser and you can see this is the part one notebook that we've worked on and now I'm going to create a new Python three notebook for part two this takes a few second No all right let's quickly change the name for the notebook fundamentals - all right now the name is changed so a quick refresher on lists since we are going to start off with list so let's say this is our list a list as we know this is an ordered sequence again so Tom 54 it can have any data type so let's say Julia comma another school let's say somebody 8 alright so this is our list let's run this Shift + Enter a list let's see if we have a dog in the correct form all right awesome so this is our list and also we learned that we can append something so it's a been a function let's append the health function which is built in the Python language so let's run this again check what do we have in the list so this help function is basically type help in for interactive help so this is another like really good function that you can use to learn about any keyword any function so let's say I want to learn about some can we have something about some yeah so it turns the sum of the sort value plus an ID variable so yeah and in case you want to quit it just type in quit and yep the function has quit so that was great now let's head over to 2d lists and so this let's say this is there's a list called B lists okay and we can define to be lists like this so let's say we have first as Tom comma Tom scored let's say it's 54 then add a comma after this and in the list Julia where the 78 so this is basically to delist how I can define there are a bunch of ways to define a to D list and if I look at let's run this way lists okay so this is basically our to-do list which is basically list of lists and in case you want to access any element so we have columns as well as rows just like in any 2d array so in case you want to access the first row oh so you can simply mention B list square brackets and the index 0 this is the first list that it's going to give you okay we lists sorry the name yeah so B list so I've got the first row which is this row over here and in case I want to access the first element which is 0 comma 0 so I can add another square records and I can if I want to access this Tom so this is 0 comma 0 and if I want to access Tom score I can mention 0 comma 1 0 or 1 so I've got the first the second element of the first row so this is basically how I can access and work with 2d lists also in case you know that negative and Xing really works so negative minus 1 means that it starts from the end so minus 1 means in the last element of your list so it works in 1d list as well basically simple Python lists on two delays as well and slicing also works the same way in to relist and yep in case you want to get B list minus 2 comma 0 that will also give you the first element Tom so big sense we have only two elements in the in this particular list and also the pen functions also would work the same way b-list abend I want to burn another name let's say Mac drama high score is 90 so yeah let's check what do we have in be less down so we have three elements so that's basically how this works a to Li lists work and this is a simple method again another way to define to-do lists is let's say there's another list called e I have a bunch of zeros in it which is and I let's say it I multiplied by five so I'll basically get five zeros in 1d list and let's check so I have five zeros in a 1d list and in case I want to convert it into a 2d list so you can simply do so yeah if I say calls equals five rows equals five as well or let's say four so I create another list Tori list which is let's say 1 and 1 I want number of columns and this is called and I want to multiply it with those so I want foros and five elements five ones so this is what I want and let's run this and check what do we have in our day list basically as you can see this is how our Dooley list has been created for us so this is five columns basically and we have four rows so let's look at tuples now so tuples is also a compound data-type like list and it's an ordered sequence which contains comma separated values inside parenthesis so this is basically let's create a tuple so again let's put Tom gamma his core so the storm this is his cool it's a 78 so these are values inside paranthesis an important thing about tupple is why they're different from list is they are immutable we cannot change them so and everything else like indexing so if I want to access the first element so indexing work just the way it works in list and if I want to access the first element and this is how I can do it if I want to change this 78 pool it says something else 90 I want to change the score of Tom so if I run this so this gives me an error that object does not support item assignment which means that Tapley cannot be changed let's go create another couple let's say let's put Julia comma her score let's say 89 and if we add these two tuples so let's see what it gives us so we have Tom 78 Julia 89 so we've added these two tuples but it doesn't mean that we have changed either of those so you can check that top one is still Tom comma 78 but what we can do is we can store this addition this particular tuple in another variable called up three top two so if you run this now top three will be your updated topple the new tuple and everything else the functions like you can learn about the length of your topple like this three and this gives you the length of your top so another important data structure is dictionary this is a Python in Bill data structure for mapping keys to values and the syntax simply looks like this let's say we have country code and it has curly braces so I have country names and so this is basically my key and I have a value corresponding to it so the core of India is let say 1 then code of USA is let's say 2 then at the China as 3 so basically this is how these keys these are keys and they have their values mapped corresponding to them and if I print country code so this is basically this is how it ends our dictionary and if we want to access any particular value we can do that using the keys so country so it uses the square bracket syntax similar to indexing which is endless and strength so let's say I want to access China's code so this is let's put this in print so China's code is 3 I think that I can do with dictionary is I can add let's say I want to add the UAE East code so I can create a new key UAE and I can add the value so let's say 4 and if we print our updated dictionary so it should have UAE appended and you can also check if something is available inside your dictionary or not you're going to go into conditionals next so this is just like let's say if you want to check if India is present in your dictionary so so if India and country code so this basically gives you a boolean true or false so India is present for conditionals we will have to understand what is boolean so python has a type called bool which can take on one or two values true or false so let's say we have a variable which is x equals true and if we want to check the type of X this will be a bool this will so boot basically X is our bully class object and if we want to check so let's say we want to compare to two values let's say if you want to check if one equals equals two so this will print false for us so one is not equal to two so one if I check one equals equals two so this gives me false and if I put one not which is not as basically denoted by this exclamation mark one not equals two so this would be true it basically helps you write some conditional statements these are a few comparisons that we can do so the comparisons operators are simply I have a equals 1 B equals 2 I can do a equals equals B let's let's just print each of them a equals equals B greater than equals less than equals and not equals so a equals equals B false here a greater than equal to 1 is not greater than 2 so that is also false a less than equal to yes that is true and is not equal to B so that is also true you can do a bunch of comparisons we can also remove these equal to signs and then run on all of them so yeah these are the comparison operators that we can use and now moving on to writing conditionals so how to write your conditional statements so let's say we have a variable called color and we have color equals red now let's say I want to check if color is red or something else so I can simply do it by using the if keyword I have if color which is my variable if color equals equals red then Colin indented and I can simply print that my color is red and then I can simply print at the end that my color color problem is solved so if I run this so let's say so I have soap my color is red and this conditional statement has turned out to be true so this has returned to color equal to e equals has returned true so the value basically the conditional statement has been satisfied it goes inside this block of code as this is indented so it goes inside and it prints color is red and then it comes out and this is my statement outside so color problem is solved that is printed at the end now let's say I want to check if let's change the color to green and let's copy paste this here I want to add so if my color is not red then what should I print so I'll print that color is not red so this is the else keyword so if this particular statement doesn't turn out to be true then I want the code or the system or the program to go here so if I run this so you can see that color is not read my else statement has turned to and if it could have been read so color is red this is true and my program comes out and prints color problem is solved and if it is something else let's say this is something else so it turns like this so let's say I want to add some more conditional statements so I can simply use Elif so I can put in Elif which is short for else f so LF color equals equals I am checking for green now then print color is green so now if I run this it should print color is green and then their problem is solved so this particular statement has turn true this is false it won't go into else since this Elif statement has gone through the program control goes here prints color is green and then comes out and prints color problem is solved that was about how we can use for Strings and another way that you can use conditional statement is let's say age equals 15 and I want to use the comparison operator if age greater than equal to 18 you print adult else you print juvenile all right so age is 15 this has turned false go program control goes into else and it prints juvenile so this is basically how we can do is the conditional statements now another thing that we need to learn about is the logical operators basically or and and not so let's learn about how these work so let's say I have a variable called 0 and if I added 2 not so not a means the opposite so it in words so this gives me true 0 stands for false 1 or any other value stands for true so equals let's say if I have 1 or any other value that's 3 so not of II would give me false because this is true or if my II would have been true so this not of a would have given me false so not okay gives me false now are coming to the or keyword so let's say I have my score equals 76 percentile is equal to 83 if score is greater than 75 I can use it inside a conditional statement if school is 75 or the percentile is greater than 90 I say that admission successful else I say print try again next year all in double quotes so if I run this so I have my score greater than 75 so percentile greater than 90 so this is so this is basically true so any of my condition either this if any of these is true the whole conditional statement will turn true and the program control would go inside this block so my score is greater than percentile is less than 90 but still my score is greater than 75 so this has turned true if I would have mentioned and here so and requires both of the conditions or all the conditions to be true if I would have added an and run this so this would have given me so this would have turned out to be false and the program control goes to else and prints try again next year since it requires both these this condition as well as my percentile condition to be true whereas or requires either one of these to be true at least so let's talk about loops now now loops is just another way of doing something repeatedly so that we don't have to write a piece of code again and again now before we talk about loops we shall understand what a range function is so this rain function it creates an ordered sequence just like a list so if you give this number that's a range five and we call this so this creates a range of zero to five now the zero is inclusive but five is not inclusive so it starts with zero but ends at four so let's say the syntax for a loop is for a for loop is so you write a for let's say a variable called I and I traitor in range called 5 let's say range of 5 and I want to inside this loop so this is my loop definition and I go inside and I print my iterator print I so this will basically print the entire sequence and if I run this so this prints from 0 to 4 so I said the 5 is excluded so since it starts from 0 so I have 5 elements so all of them are printed from the sequence that this range function is created so this is basically one way of creating this loop and inside the loop I can do a bunch of tasks not just printer so let's say for I in range 5 I want to print let's say I want to calculate product equals I say P it star I multiply everything so this gives me multiplicative factors of 8 so you can also mention the starting value let's say 1 I want to start my loop from 1 I want to take it up till 2 and I want to mention the step size as well so let's say 2 so now I will this loop will start with 1 and the jump size the step size is 2 so from after 1 ill good 3 instead of 2 and it's n at 9 not a 10 but 9 since the stent is excluded so now if I do the same thing and print this so this is 8 into 1 then into 3 then 8 into 5 and 8 & 7 & 8 into 9 let's create a couple called names let's put her comma comma comma so another way is that you can iterate over a list for a couple is that I can simply use the list or the tupple for name in my list or might Apple for name in names I can simply print the name these are all strings let's convert them into uppercase so if I run this so you see it goes to each of those elements it picks up all each of these elements in the list or the tupple whatever that you have and it converts each of these trains into uppercase and prints them now you use value let's create list page with some numbers 1 12 4350 45 and 10 and now let's start a variable i with 0 i have initialized this variable i with 0 then I write Y so this is basically the syntax while I mentioned the conditional statement where I want to break it so while I is length of each length of ages my length of my list this list of edges that I've created Colin I enter into the do so then I put a conditional statement health if age of I this is how I access my list element so if age of I is greater than equal to 18 I print adult it's I print juvenile so this if I run and the last thing that you have to take care of is you have to increment your iterator variables this is a right Reiter variable having she lies it with zero and it'll go up till the end of this list so I am basically iterating over the list and it will check if I is up till the length of age and I'll keep increment a incrementing my iterator with one so if when I run this this what happens is this I is zero here and length of each length of this list is 4 so 0 is less than 4 so that is true now inside I go so I is currently 0 years of 0 this is the first segment 12 is greater than equal to 18 so that is false so it goes into else prints juvenile and increments my eye traitor variable by 1 so eyes now 1 goes again I is 1 now it is less than for age of 1 which is 43 is greater than equal to 18 so this condition turns out to be true so I have juvenile for the first and the last element which is 12 and 10 and adult for the other two so this is basically how I write my while loop so now that we have covered loops so there is an important concept of list comprehension which will come across quite often so list comprehension is one of patterns most you know beloved and unique features so you mean this is just another way of definitely defined in your list so let's say you want to store squares or cubes in a particular list so how you can create a list s you can simply do n star star 3 for n in range 1 comma 10 so if I let's say I want to create this list where I am storing the cubes so this will keep storing my cubes in my list keep appending them and if I see what is in side my cubes so this is basically what my cubes list looks like so this is list comprehension where I have mentioned what needs to be stored here and then the for loop ahead of it so if I I would have done it like simply so this would have been seen for I in range 1 comma 10 so there is a list called cubes and this list is cube dot append I star star 3 and if I would have printed cubes now so this would have given me the same result so this is what list comprehension does in just a single line of code so let's talk about functions if seeking and we have been using functions such as print range length append function so python has many more built-in functions and also we can go on and define our own functions which is the big part of Python programming so whenever you come across a new built-in function what you can do is and you don't know what that function does you can simply run help function over that so let's say we have we don't know there's a function called absolute abs we don't know what it does so you can run the help function so it tells you that it returns the absolute value of that arguments so if I run absolute over an expression let's say 2 minus 5 so 2 minus 5 is minus 3 but it gives me the absolute value of minus 3 which is 3 so we can use help function and absolute function like this so there are many other built-in functions in the Python language let's talk about how we can define our own functions in Python the syntax basically looks like this so we have a keyword to define which goes in the header of our function so define so let's say let's create add to numbers and it takes arguments which is basically the inputs a function is it takes input and it processes it the just evaluates a few expressions and then gives you the output so add two numbers it will take two numbers a comma B then we'll calculate the sum a plus B and then return this sum so this is our function I had two numbers let's call this run this cell add two numbers and then pass on five comma 11 let's say so this gives us 16 so it has rightly evaluated the expression A plus B and given us this result this is basically how we can define our own functions now this a plus B we could have done something more complex this return we have some important things here so this is our function header which is basically which contains the DEF keyword then another important keyword is the return keyword remember this is encountered our function basically gets over and it gives you whatever the result is at that point of time a this is the body of our function and these a comma B are the arguments that the function takes or the input that the function takes this is basically what function looks like so let's try to write a function in the best possible manner Fahrenheit temperature to Celsius and then pass on the temperature inside now anytime you write a function you should document your functions like this so these are called docstrings anything that you write between these would be commented this is not good this is the documentation of your function missed it basically you write so that kuso ever reads your code should be easily able to understand what this function does what it takes as input what it returns as output this is basically what my function does and I have the arguments defined I have the returns statement defined so now I am going to do the calculation so temperature and Celsius is equal to so the formula is basically temperature - 32 multiplied by 5 by 9 so this is my and then I returned temperature in Celsius so this function basically converts temperature from Fahrenheit to Celsius now if I call this let's see what is 50 50 degree Fahrenheit and Celsius that is just 10 degree Celsius oh that's awesome so this is basically what functions - so you can all define like really complex large functions and this is what you are going to do when you go into solving data science problems there will be a bunch of things that you'll be doing inside a function but the important thing that you have to keep in mind is that you should be focusing on defining what the purpose of that function is what it does what it takes as input how to define your dark strings so those are the important concepts of writing function so you've seen how do 2d lists and tuples work how to write loops conditional statements branching statements how does slicing works and how do functions work in Python and what is the best way to write functions so at this point what in this video is just not enough and you'll have to practice all these concepts so for that I have prepared an assignment which you can use to practice and I've added the link to the github repository as well as the Google Collaborate you notebook that you can use to practice also that might not be enough so you can head over to platforms like lead cold hacker and or coding ninjas where you will find basic or moderate level problems that you can use and practice so in the next part we'll be covering object-oriented programming modules and packages how do we write code how do we use code written by others so if you have found this video useful don't forget to like the video and feel free to add any thoughts comments suggestions in the comment section below and make sure that you subscribe to the channel so that you don't miss out on all the upcoming videos part three is coming out soon so till then stay tuned and keep learning data science with her shed yes

Original Description

This the second part of the 3-part python fundamentals series. We have covered : * 2D lists * Dictionaries * Conditional statements * Loops Blogpost: https://towardsdatascience.com/python-fundamentals-for-data-science-6c7f9901e1c8 Link to the GitHub repo: https://github.com/dswh/python_fundamentals Exercise notebooks can be found here: t.ly/ns2o Medium Blog: https://medium.com/@harshit_tyagi You can connect with me on: LinkedIn: https://www.linkedin.com/in/tyagiharshit/ Medium where I -write: https://medium.com/@harshit_tyagi Instagram(for health and wellness): https://www.instagram.com/upgradewithharshit/?hl=en
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Harshit Tyagi · Harshit Tyagi · 6 of 60

1 Your PATH to learning Data Science
Your PATH to learning Data Science
Harshit Tyagi
2 Ideal Python environment setup for Data Science projects - Unix shell, Anaconda and Git.
Ideal Python environment setup for Data Science projects - Unix shell, Anaconda and Git.
Harshit Tyagi
3 Building COVID-19 interactive dashboard from Jupyter Notebook | No frontend/backend coding required.
Building COVID-19 interactive dashboard from Jupyter Notebook | No frontend/backend coding required.
Harshit Tyagi
4 Introduction to Jupyter Notebooks - Interface | Ipython Kernel | Sharing | GitHub
Introduction to Jupyter Notebooks - Interface | Ipython Kernel | Sharing | GitHub
Harshit Tyagi
5 Python fundamentals for Data Science - Part  1 | Data types | Strings | Lists
Python fundamentals for Data Science - Part 1 | Data types | Strings | Lists
Harshit Tyagi
Python fundamentals for Data Science - Part 2 Dictionaries | Conditionals | Loops | Functions
Python fundamentals for Data Science - Part 2 Dictionaries | Conditionals | Loops | Functions
Harshit Tyagi
7 Python fundamentals for Data Science - Part 3 OOPS | Working with External Libraries & Modules
Python fundamentals for Data Science - Part 3 OOPS | Working with External Libraries & Modules
Harshit Tyagi
8 NumPy Essentials for Data Science - part-1 | One Dimensional Array
NumPy Essentials for Data Science - part-1 | One Dimensional Array
Harshit Tyagi
9 NumPy Essentials for Data Science - part-2 | Multi-Dimensional Array
NumPy Essentials for Data Science - part-2 | Multi-Dimensional Array
Harshit Tyagi
10 Math For Data Science | Practical reasons to learn math for Machine/Deep Learning
Math For Data Science | Practical reasons to learn math for Machine/Deep Learning
Harshit Tyagi
11 Linear Algebra Ep 1 | Introduction to Vectors, Matrices and Tensors using NumPy
Linear Algebra Ep 1 | Introduction to Vectors, Matrices and Tensors using NumPy
Harshit Tyagi
12 Linear Algebra Ep 2 | Dot Product in Linear Algebra for Data Science
Linear Algebra Ep 2 | Dot Product in Linear Algebra for Data Science
Harshit Tyagi
13 Python vs R | The BEST programming language for your Data Science Project
Python vs R | The BEST programming language for your Data Science Project
Harshit Tyagi
14 Linear Algebra for Data Science Ep3 | Identity and Inverse Matrices | NumPy
Linear Algebra for Data Science Ep3 | Identity and Inverse Matrices | NumPy
Harshit Tyagi
15 The Data Show Ep1 | Elucidating Data Science in Drug Discovery - A CTO's Account
The Data Show Ep1 | Elucidating Data Science in Drug Discovery - A CTO's Account
Harshit Tyagi
16 Google Certified TensorFlow Developer | Learning Plan, Tips, FAQs & my Journey
Google Certified TensorFlow Developer | Learning Plan, Tips, FAQs & my Journey
Harshit Tyagi
17 Speeding up your Data Analysis | Hacks & Libraries
Speeding up your Data Analysis | Hacks & Libraries
Harshit Tyagi
18 How to build an Effective Data Science Portfolio
How to build an Effective Data Science Portfolio
Harshit Tyagi
19 End-to-End Machine Learning Project Tutorial - Part 1
End-to-End Machine Learning Project Tutorial - Part 1
Harshit Tyagi
20 Data Preparation with Sci-kit learn and Pandas | End-to-End ML Project Tutorial - Part 2
Data Preparation with Sci-kit learn and Pandas | End-to-End ML Project Tutorial - Part 2
Harshit Tyagi
21 Training and Fine-Tuning ML Models with Sklearn | End-to-End ML Project Tutorial - Part 3
Training and Fine-Tuning ML Models with Sklearn | End-to-End ML Project Tutorial - Part 3
Harshit Tyagi
22 Deploying a Trained ML model via Flask on Heroku | End-to-End ML Project Tutorial - Part 4
Deploying a Trained ML model via Flask on Heroku | End-to-End ML Project Tutorial - Part 4
Harshit Tyagi
23 Three Decades of Practising Data Science | Interview with Dean Abbott
Three Decades of Practising Data Science | Interview with Dean Abbott
Harshit Tyagi
24 Calculating Vector Norms - Linear Algebra for Data Science - IV
Calculating Vector Norms - Linear Algebra for Data Science - IV
Harshit Tyagi
25 Ep1 - Getting Started | Zero to Hero in Computer Vision with TensorFlow
Ep1 - Getting Started | Zero to Hero in Computer Vision with TensorFlow
Harshit Tyagi
26 Ep3 - Designing Data Experiments to enhance your Product | Rapido's Data Science Lead, Pramod N
Ep3 - Designing Data Experiments to enhance your Product | Rapido's Data Science Lead, Pramod N
Harshit Tyagi
27 Building projects with fastai - From Model Training to Deployment
Building projects with fastai - From Model Training to Deployment
Harshit Tyagi
28 October AI - Video Calling with One-Tenth of Internet Bandwidth
October AI - Video Calling with One-Tenth of Internet Bandwidth
Harshit Tyagi
29 November AI - Breakthrough in biology after 50 years | Datasets, books, research papers and more...
November AI - Breakthrough in biology after 50 years | Datasets, books, research papers and more...
Harshit Tyagi
30 Data Science learning roadmap for 2021
Data Science learning roadmap for 2021
Harshit Tyagi
31 Talk is cheap, BUILD - Microsoft Software Engineer | Interview with Abhirath Batra
Talk is cheap, BUILD - Microsoft Software Engineer | Interview with Abhirath Batra
Harshit Tyagi
32 Building a Habit of Reading Research Papers | Ft. Anurag Ghosh(Microsoft Researcher)
Building a Habit of Reading Research Papers | Ft. Anurag Ghosh(Microsoft Researcher)
Harshit Tyagi
33 Tableau vs Python - Building a COVID tracker dashboard
Tableau vs Python - Building a COVID tracker dashboard
Harshit Tyagi
34 [Explained] What is MLOps | Getting started with ML Engineering
[Explained] What is MLOps | Getting started with ML Engineering
Harshit Tyagi
35 Dmitry Petrov - Creator of DVC | ML Systems, Teams, Scaling challenges, and Learning Data Science
Dmitry Petrov - Creator of DVC | ML Systems, Teams, Scaling challenges, and Learning Data Science
Harshit Tyagi
36 Five hard truths about building a career in Data Science
Five hard truths about building a career in Data Science
Harshit Tyagi
37 Computing gradients using TensorFlow | Training a Linear Regression model from scratch.
Computing gradients using TensorFlow | Training a Linear Regression model from scratch.
Harshit Tyagi
38 Foundations for Data Science & ML - First steps for every beginner!
Foundations for Data Science & ML - First steps for every beginner!
Harshit Tyagi
39 Course Outline - Foundations for Data Science & ML
Course Outline - Foundations for Data Science & ML
Harshit Tyagi
40 How Machine Learning uses Linear Algebra to solve data problems
How Machine Learning uses Linear Algebra to solve data problems
Harshit Tyagi
41 Calculus for ML - How much you should know to get started
Calculus for ML - How much you should know to get started
Harshit Tyagi
42 Building a buzzing stocks news feed using NLP and Streamlit | Named Entity Recognition & Linking
Building a buzzing stocks news feed using NLP and Streamlit | Named Entity Recognition & Linking
Harshit Tyagi
43 AI Engineer - The next big tech role!
AI Engineer - The next big tech role!
Harshit Tyagi
44 AI researcher vs AI engineer | The next big tech role!
AI researcher vs AI engineer | The next big tech role!
Harshit Tyagi
45 Reviewing LLMs for content creation
Reviewing LLMs for content creation
Harshit Tyagi
46 Building a chatGPT-like bot on WhatsApp #coding  #chatgpt #engineering
Building a chatGPT-like bot on WhatsApp #coding #chatgpt #engineering
Harshit Tyagi
47 High Signal AI - the most action-oriented newsletter on the web! #ai
High Signal AI - the most action-oriented newsletter on the web! #ai
Harshit Tyagi
48 Building an AI-powered Discord Chatbot Locally for FREE using Ollama
Building an AI-powered Discord Chatbot Locally for FREE using Ollama
Harshit Tyagi
49 Build a second brain with Khoj 🧠  #ai #obsidian #plugins #productivity #engineering #notes
Build a second brain with Khoj 🧠 #ai #obsidian #plugins #productivity #engineering #notes
Harshit Tyagi
50 Summarising YouTube Videos using Ollama on Discord | Becoming an AI Engineer - Ep 2
Summarising YouTube Videos using Ollama on Discord | Becoming an AI Engineer - Ep 2
Harshit Tyagi
51 Watch the full video on my channel - Roadmap to become an AI Engineer.
Watch the full video on my channel - Roadmap to become an AI Engineer.
Harshit Tyagi
52 Mesop - Python-based UI framework from Google!
Mesop - Python-based UI framework from Google!
Harshit Tyagi
53 How I automated my YouTube | Gumloop tutorial | No Code
How I automated my YouTube | Gumloop tutorial | No Code
Harshit Tyagi
54 ARC PRIZE - Win $1Million to Beat the ARC-AGI benchmark
ARC PRIZE - Win $1Million to Beat the ARC-AGI benchmark
Harshit Tyagi
55 Microsoft's Autogen vs CrewAI - tested on a diverse range of use cases
Microsoft's Autogen vs CrewAI - tested on a diverse range of use cases
Harshit Tyagi
56 Claude #AI artifacts are just amazing!
Claude #AI artifacts are just amazing!
Harshit Tyagi
57 OpenAI releases CriticGPT to correct GPT-4's mistakes | Read the paper with me
OpenAI releases CriticGPT to correct GPT-4's mistakes | Read the paper with me
Harshit Tyagi
58 Day in my life | Vlog #1
Day in my life | Vlog #1
Harshit Tyagi
59 How to add AI Copilot to your application using CopilotKit | Tutorial
How to add AI Copilot to your application using CopilotKit | Tutorial
Harshit Tyagi
60 Quick Questions with an AI Founder - Anudeep Yegireddi
Quick Questions with an AI Founder - Anudeep Yegireddi
Harshit Tyagi

This video teaches Python fundamentals for Data Science, covering topics like 2D lists, dictionaries, conditional statements, loops, and functions. It provides hands-on experience with Python and Jupyter Notebook, and is essential for data scientists and analysts.

Key Takeaways
  1. Create a 2D list by multiplying a 1D list by a number of rows and columns
  2. Define a dictionary and access its elements using the square bracket syntax
  3. Use conditional statements with comparison operators
  4. Implement loops using the range function
  5. Define a function using the def keyword and document it with a docstring
💡 List comprehension can be used to create a new list in a single line of code, making it a powerful tool for data manipulation

Related AI Lessons

Your ChatGPT History Is a Liability. I Fixed That With a $80 Chip and a Pi5.
Protect your ChatGPT history from being used as evidence with a simple hardware solution using a $80 chip and a Pi5
Medium · AI
The Dark Side of AI: What We Lose When We Stop Thinking
Discover how AI's benefits come with a cost to human critical thinking skills, and why it matters for professionals to be aware of this trade-off
Medium · AI
AI Security Isn't a Product. It's an Engineering Discipline.
Learn why AI security requires a continuous engineering discipline rather than a one-time product implementation, and how to apply this mindset to your AI development workflow
Dev.to AI
Why Solving Legal AI's Context Problem Is Harder Than You Think
Solving legal AI's context problem requires understanding decision-making processes, not just having large models
Forbes Innovation
Up next
Containers Don't Make Your AI Agent Safe
Web Dev Simplified
Watch →