๐ Basics Workshop @What After College
Python
Workshop Timings
Workshop Dates: 25th - 26th July 2020Workshop Timings: 9:00 AM - 2:00 PM (9 - 14)
Break Timings: 11:00 AM - 12:00 AM (11 - 12)
Workshop Link (Zoom)
Index
- Introduction
- Getting Started with Python
- Day 1
- Day 2
- Capstone Project
- Further Reading
- Python Books
- Future Path??
Introduction
Solutions to all sample problems on HackerRank under the Python domain can be looked up here.
Programming is a very hands process and is both an art as well as a science. We are engineers and are required to create efficient solutions but at the same time our programs should be highly readable and flexible and all the other snappy terms which makes it an art as well.
To become proficient in this art, there are many resources, and books and tutorials. Each has it's merit and making the first step in any direction is commendable, but the cardinal factor at the end of the day will be you sitting down (or standing) and writing code. No book or resource can substitute that.
So, what are you waiting for
Happy Coding ๐ฑโ๐ป
You can stalk your instructor on LinkedIn & GitHub.
Getting Started With Python
We need to install and configure a few things before we can write and run any Python code. To write Python code we need the Python interpreter on our machine.
1. Install the Python 3 Interpreter
To write python programs on your machine we need the Python interpreter. There are 2 popular versions of Python
out there right now Python 2 and Python 3. There are breaking changes between these versions and this course will be
taught in Version 3. So as long as you have python version 3.{something}.{something} you're good to go
Download python from this website
To check that python has been correctly installed on your machine run the following command on your terminal:
python --version
It should have an output akin to:
Python 3.8.3
Once that Python has been successfully installed, we need to install a code editor or IDE so that we can write
programs and run them. I suggest using VS Code if you prefer a Code editor over an IDE (or if you don't know the
difference between Code editor and IDE
I personally prefer the JetBrains PyCharm, but warning
2. Installing VS Code (or go to step 3 - Installing PyCharm)
- Download the setup from here.
- Run the setup which is pretty straight forward. Just click next like 10 times and voila!
3. Installing JetBrains PyCharm
- You can either install the educational edition (free) from here.
- Or you can create an account on JetBrains if you have a university email address and then install the JetBrains Toolbox.
- You can easily manage JetBrains IDE's and projects using the ToolBox app. From the ToolBox app you can now install either IntelliJ PyCharm Edu Edition or Ultimate Edition.
4. Installing git (Optional - Only required for Windows users)
This is an optional step of your getting started guide and can be skipped. Although installing git and using it in your projects is highly recommended. For a learning path to learn git have a look at the Future Path + Scope section.
Install git from the git-scm website. Run the setup and click next like 10 times and use the recommended settings for installation.
There will be a section when it will ask the standard text editor and gie you an option between Vim and nano. If you are not familiar with Vim then opt for nano.
IMPORTANT Opt for nano if not familiar with Vim.
To check your installation of git check that git bash has been intalled and run the following command on your terminal.
git --version
The output should be akin to
git version 2.24.1.windows.2
5. Writing your first Python Program
Open your text editor/IDE and create a new file hello_world.py
and in that file copy paste the following code
snippet.
print('hello world !')
To run the code navigate to file in terminal and run the following commands.
python hello_world.py
>>> hello world !
Day 1
Topics Covered
- Hello World!
- Comments
- Strings
- Variables
- Variable Names
- Taking user input
- Taking Integer Input
- Arithmetic Expressions
- Operator Short Hand Notation
- Logical Expressions
- If Else Programs
- Even and odd using if else
- Ternary Operator
- Largest of 3 Numbers
- Python If Ele HackerRank
- While Loop
- Sum N Natural Numbers
- Factorial
- Range Object
- For Loop
- Sum N Natural Numbers
- Sum Squares
- Factorial For Loop
- Nested Loops
- Loop Control Statements
- Functions
- Positional Arguments in Functions
- Binomial
- Lists
Sample Questions
Day 2
- List Input
- Map Operator
- Iterating over List using For Loop
- inbuilt Functions
- Hackerrank Mini Max Sum
- List Comprehension / Generator Functions
- Strings
- Tuples
- Dictionary
- Word Frequency Counter
- Complex Nested Dictionary
- Packages
- Random Package
- plotting using MatPlot Library
Topics Covered
Sample Questions
Hangman Game (Capstone Project)
The code can be viewed here.
Another game
Further Reading
- w3 School Python
- HackerRank python Domain
- Why is it called Python?
- Projects Created on Python
- C++ vs. Java vs. Python Language Speed Test (Informal)
- Math Module
- Stack Overflow Survey 2020
- Python Example Projects and Project Based Tutorials
- Django: Web Development on Python
- Falcon: Minimalist Web Framework
๐
Python Books
Future Scope and Path
Now that you have learnt the basics of Python and also built an amazing project that showcases your skills, how to move ahead and learn more? What else could you work on? Here are a few suggestions:
Data Structures and Algorithms
Data Structures and Algorithms is an immensely important topic required for Software development and is used by organizations for all sizes as a tool for employee hiring and recruitment. To get better at this I recommend that you practice questions in the Data Structures and Algorithms domain on HackerRank and you can have a look at solutions to many of those problems in the solution repositories given below.
Problem Domain | Solution Repository |
---|---|
Data Structures | Solutions |
Algorithms | Solutions |
You can views solutions to problems in Python (or any of your preferred programming language) and you are most welcome to contribute to the repository solutions to unsolved problems or solutions in more languages (aka Python).
You can also try questions on Leet Code and have a look at the
solutions repository
and are most welcome to contribute just as above
Core Python
Before starting of your journey in Data Structures or web development or even machine learning another good first step can be just developing your core Python skills further so that you are familiar with all the different constructs that the language has to offer. That can be done on HackerRank in the Python Domain and you can have a look at solutions to all the problems here.
Web Development
Python is a very versatile programming language and is being used for all things from biology to robotics, computer vision and even serve side rendered web applications and api's. As you are now proficient with the programming language you can start learning a web development framework like Django or Falcon.
Django is a have all web development framework and you can even build very large, highly modern cluster based web sites that can be deployed to scale. You can use it just to create a server-side API with a separate client facing application or a MVC (Model view controller) based application that has server side rendering.
Falcon is a relatively light weight web development platform but it is blazing fast
You could always use multiple server side frameworks which will give you the perfect opportunity
to use buzz words like docker, kubernetes
๐ฅ
Machine Learning Speaking of buzz words... Machine Learning has enjoyed fame of meteoric proportions and there are
plenty of resources to get started with ML and Python has somehow become the defacto language
used in Machine Learning / Deep Learning applications and is being sed by Engineers &
scientists of many different domains that have written numerous libraries serving various purposes
all around the globe
Some popular libraries are:
To get started with Machine Learning I recommend the ubiquitous Machine Learning by Stanford course on Coursera by Andrew Ng.
This may be old but it's essence and relevance haven't dwindled at all. Solutions to all problems with well written code can be found here.
Learning Git
This is not very correlated to Java, but Git is a technology being used by all organizations big and small that wish to maintain their code over teams of varied sizes and manage projects. Even this repository which you are currently reading in is being maintained by git & has been deployed on github.
Being proficeint with git and version control will help you manage all your projects, be in any language Java, Python, C++ and even non-programming projects very efficiently and you will be able to easily maintain project state over all your devices.
There is an excellent Version Control with Git course on Coursera by Atlassian or you can even try this Git Introductory 30min Video on YouTube to learn the basics of git.
So, what are you waiting for git started