Python Overview: Python is a widely used high-level, general-purpose, interpreted, dynamic programming and easy to learn programming language. You can use it to create web apps, games, even a search engine. This tutorial will walk you through the concepts of Python programming language.

Try it out!

Print “Welcome to Python!”

Prerequisites

No prerequisites are required for learning python A basic understanding of any of the programming languages is a plus.

python_overview               Image Source: zurbigg.com

 

History of Python

Python was developed by Guido van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.

Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, and UNIX shell and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under the GNU General Public License (GPL).

Basic Building Blocks of Python – Variable

A variable stores a piece of data and gives it a specific name.

For example: python = ‘Awesome’

This will initialize the variable python and assign it a value ’Awesome’. The variable python now stores a string ‘Awesome’.

Try it out!

python=’Awesome’

Print python

This will print the value of python variable which is ‘Awesome’ and display it in the output. One can also assign booleans i.e like a light switch which can only have two values. Just like a light switch can only be on or off, a boolean can only be True or False.

For example: switch = True will assign switch to boolean True. Remember that True in python is case sensitive which should always start with initial capital letter. ‘Print’ in python is used to print the output mentioned to the console or the screen.

Recommended Post   While Loop Python

Try it out!

Write a program to swap two numbers using variables?

Solution: Think of this problem as that you are having two glasses A and B and you want to swap the water present in A and B. So you will use a third glass C and put contents of A in C and then B to A and finally C to B. Use this concept to perform swap between two variables.

Program:

A = 5

B = 3

Print A, B

C = A

A = B

B = C

Print A, B

Output:

5 3

3 5

Now you have learned about the variable, how variables are declared and assigned and you have also made a program of your own to swap two numbers and print the results on the console. Sounds good enough?

LEAVE A REPLY

Please enter your comment!
Please enter your name here