These days everyone is trying to enter into the machine learning or data science field. Python programming language is one of the most crucial parts of this journey. In this post, we will discuss how one can learn python for data science or machine learning.
If you talk to some educator who is comfortable with python, he will suggest you some books or youtube video lectures. But In my opinion, if you are comfortable in one programming language, you need not buy any book or watch some video lectures to learn python. I will highly suggest you follow this post rigorously, and you will be comfortable with python in just 4-5 days. So let’s start our python journey.
First, you have to install python in your system. You can use any python editor of your choice. I will suggest you use juypter notebook. You can install it by watching this youtube video: Install Juypter Notebook
Now you have to solve the following problems. These problems will cover almost all the topics that are required for your data science journey.
- Write a program to find the sum of two numbers using python.
Hint: https://www.geeksforgeeks.org/taking-input-in-python/
Learning: Take input from the keyboard, print the output on the screen.
- Make a calculator using a simple if-else statement. It should perform sum, subtract, multiplication, and division operations.
- Given an integer, print whether the number is odd or even.
Hint: https://www.geeksforgeeks.org/python-if-else/
Learning: Use of multiple if-else statements, taking input from the keyboard, printing output on the console.
- Write a program (using for as well as while loop) that will take some integer as input and will print the table of that number.
- Write a program to check if the given number is prime or not. U)
Hint: https://www.geeksforgeeks.org/loops-in-python/
Learning: In the above two problems, you will learn the use of for and while loop in python.
- Write a program to count the number of characters in a string.
- Write a program to count vowel and consonant in a string.
Hint: https://www.geeksforgeeks.org/python-strings/
Learning: You will learn how you can take the string as input and access every character of that string.
- Write a program that will take a list of integers as input and calculate the sum of all the elements.
- Write a program to search an element in the list.
- Write a program to count how many times a particular element has occurred in the list.
- Write a program to remove all the duplicate elements from the list.
Hint: https://www.geeksforgeeks.org/python-list/
Learning: In the above problems, You will learn how to take a list as an input and access the elements of that list.
You May Like: Everything you need to know about machine learning syllabus to become a data scientist
- Write a program to count the number of occurrences of each word in a sentence (use dictionary to solve the problem).
- Write a program to calculate the occurrence of each integer in a list.
Hint: https://www.geeksforgeeks.org/python-dictionary/
Learning: In the above two problems, you will learn the use of a dictionary in python.
- Read the data from a text file containing comma-separated integers, and save the sum of all the integers in a text file. (you can create the files yourself)
- Extract all the even integers from the file, and store them in a new text file.
- Similarly, extract all the odd integers from the file, and store them in a new text file.
Hint: https://www.geeksforgeeks.org/reading-writing-text-files-python/
Learning: reading a text file, saving the results in a text file.
Once you solve all the problems given above, you are good at starting your machine learning or data science journey. Rest of the advanced topics, you can learn during your data science journey.
I will suggest to create a GitHub repository and keep the solution of all the problems in that repository.
Share the Link of your GitHub repository in the comment section. I will provide you some advanced level questions once you are done with the above-given problems.
You May Like: How to prepare data structure and algorithms for machine learning or data science interview?