Python Basics

What is Python?

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). For more information, you can visit python official website https://www.python.org/ .

How Python was born

Python programming language first appeared in 1990 at Centrum Wiskunde & Informatica (CWI) in the Netherlands as a successor to the ABC language (itself inspired by SETL). The idea for writing a new programming language struck Guido van Rossum while he was working on ABC language where he faced many problems. Like all the functionality were built-in into its core and if he wants to make some changes in any one of the functionalities he has to make the changes into the core of the programming language. Which inspired him to work on Python programming language where rather having all the functionality in the core of the programming language, he made python extensible which means if you want to add new functionality to the language, you would not have to make changes into its core. All you need to do is to make a library for that functionality. It becomes available to the whole Python community.

Python Warriors at your rescue

We at PythonWarriors have the same mission as python language itself. That is, to make it easy for new budding programmers to get the grasp of this mighty programming language in an easy way.

In this guide, you’ll get the base start for starting in Python programming language. If you are familiar with any other programming languages then you won’t find any difficulty starting with python. But even if you are a newbie who has just started and chosen python as your first programming language you won’t find any difficulty with it.

Why Python is the best language, to begin with

  • Simple, easy to use syntax which makes it the best language to start.
  • The main and important feature of the Python programming language is being open-source and free to use. Which allows the developers all over the world to help and grow the Python community.
  • Python community continuously contribute towards python and which is why we have so many libraries available for everything. These libraries can be used by anyone. Even you would use some of the libraries overtime here.
  • Python programming language is Interpreted language which means you don’t need to compile your programs before executing it.
  • It supports multiple programming paradigms, which includes procedural, object-oriented, and functional programming.
  • With a strong knowledge of Python, you can create high scale applications and there are many big names out there which are made using python and python frameworks such as Instagram, Reddit, Mozilla.
  • The community of Python Programming Language is very vast and always ready to help you whenever you get stuck somewhere.

The philosophy behind Python programming language is clearly or more accurately defined in the similar fashion that python uses in the document The Zen of Python(PEP 20). That is a few lines of codes, more work. This document contains 20 aphorisms of which five are shown below.

  • Beautiful is better than ugly
  • Explicit is better than implicit
  • Simple is better than complex
  • The complex is better than complicated
  • Readability counts

If you are interested in knowing more about the document then look out here The Zen of Python.

Code War Begins

So what are you waiting for, fasten your seatbelt and let’s get started with Python. Let’s write the most famous piece of code ever written in the history of mankind a.k.a “Hello World”.


print(‘Hello World’)

So how many lines did it take to write Hello World in Python? Just one! That’s how you do it with Python programming language. Did you see the syntax, It’s the same as writing English!

Let’s take another program for example. Let’s take two numbers and multiply them.


# Program to multiply two numbers

n = 5

m = 6

Prod = n*m

print(Prod)

So let’s start with line 1 which starts with a special character # which is a way to write single line comments in Python. And for your multi-line comments, you do this:


“““ Hi I’m a

Multi-line

Comment”””

Now moving on to the next line you will see a number is assigned to n. That’s how you assign values to a variable in python. One of the major assets of python is that you can declare your variable anywhere in the program. During the execution of the programs, all the variables which were declared would move dynamically to the top.

Since python is a dynamic programming language, You don’t need to define the data type of a variable as you can clearly see, You didn’t declare any. During execution, python interprets the variables and check for the data type of the variable.

Now as for line 4, Here we are multiplying the above two variables with the multiplying operator(*) and assigning it to the new variable.

Now for the final line, which says print(Prod)  uses a python built-in function print() which here prints what is stored inside the variable Prod. These built-in functions are the backbone of any programming language and if you want to learn more about these built-in functions. Then visit our Library page for more interesting functions and lots of libraries which are developed to ease the work on developer’s shoulder.

Warrior’s Word

I’m quoting one of the best quotes for a warrior in you:

If a warrior is to succeed at anything, the success must come gently, with a great deal of effort but with no stress or obsession.  

-Carlos Castaneda

So call out the warrior within yourself and get on this journey with us. Let’s help each other in growing together in learning the best programming language in town.

Python is a very powerful programming language and at the same time simple to understand. You will learn at PythonWarriors  this powerful language in a simple way.

Come. Join us.

Index

  1. Getting Started