Python Basics

Basics of Python Programming


Introduction to Python

Python is an easy to learn and very powerful programming language. It has efficient data structures and a simple approach to object-oriented programming. Python’s syntax together with its interpreted nature, make it an ideal language for scripting and rapid application development.

Getting Started

  • To start coding in Python, you'll need a Python interpreter or a development environment. 
  • The Python interpreter and the python standard library are freely available for all major platforms from the Python’s official web site, https://www.python.org/.

How to run Python program using IDLE software?


Executing Python Program using IDLE


Why it is called Python?

Python programming language was originally designed by Guido van Rossum. When he began implementing Python, he was also reading the scripts from “Monty Python’s Flying Circus” (a BBC comedy series). He wanted a short, unique, and slightly mysterious name of language, so he decided to call the language Python. Python computer language has nothing to do with reptiles (pythons).


Type of Software that you can developed using Python


Use of Comments in Python

It is good practice to write comments in program code. In the header part of your program, you can write your name, date of program and practical definition. Comments are also used to describe the program logic.

Many of the python Practicals in this site include comments.
  • # (hash) is the character used for Comments in Python. Any line started with # in Python code is considered as a comment line.
  • A comment may appear at the start of a line but not within a string literal. A # character within a string literal is just a hash character.
  • Comments are used to describe the code and are not interpreted by Python.

Example of Comments in Python

# This is the sample comment.
# Program is developed by K Patel.
# Date: 20-August-2019
# Definition: Python program to print Hello World.

print ("Hello Python Practicals")

Output of above code:


Hello Python Practicals

Following # is not a comment as it is written inside a string

>>> print ("#Hello Python Practicals")
#Hello Python Practicals

Let's begin with Python Numbers 


No comments:

Post a Comment