PYTHON 20SC02P
Unit 4- INTRODUCTION TO PYTHON PROGRAMMING
1. WHAT IS PYTHON?
Python is a general purpose, high level, interpreted popular programming language.
It is computer programming language; It was created by Guido van Rossum in 1989, and released in 1991.
2. WHAT ARE APPLICATIONS OF PYTHON?
Web Development.
Game Development.
Machine Learning and Artificial Intelligence.
Data Science and Data Visualization.
Desktop GUI.
Web Scraping Applications.
Business Applications.
Audio and Video Applications.
3. WHY PYTHON IS MOST POPULAR ?
Python has a simple syntax similar to the English language.
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python is freely available without any cost.
Library and support
Python runs on an interpreter system, meaning that code can be executed as soon as it is written.
Python can be treated in a procedural way, an object-oriented way or a functional way.
4. WHAT DO YOU MEAN BY SYNTAX IN PYTHON?
The syntax of the Python programming language is the set of rules that defines how a Python program
will be written and interpreted.
EXAMPLE
Python was designed for readability, and has some similarities to the English language with influence
from mathematics.
Python uses new lines to complete a command.
Python relies on indentation, using whitespace, to define scope; such as the scope of loops,
functions and classes.
5. WHAT DO YOU MEAN BY COMMENTS IN PYTHON?
Comments start with a #, and Python will render the rest of the line as a comment:
Example: #This coding is to print hello world
print("Hello, World!")
6. WHY COMMENTS ARE USED?
Comments can be used to explain Python code.
Comments can be used to make the code more readable.
Comments can be used to prevent execution when testing code.
Comments starts with a #, and Python will ignore them:
Comments can be placed at the end of a line, and Python will ignore the rest of the line:
print("Hello, World!") #This is a comment
HGR, BPS. Page 1
PYTHON 20SC02P
7. WHAT ARE VARIABLES IN PYTHON?
In Python, variables are created when you assign a value to it. Python has no command for declaring a
variable. x=5
y = " BAPUJI POLYTECHNIC "
8. HOW VARIABLES ARE CREATED?
A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).
Rules for Python variables:
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
Variable names are case-sensitive (age, Age and AGE are three different variables).
A variable name must start with a letter or the underscore character.
A variable name cannot start with a number.
legal variable names: Illegal variable names:
2myvar = "John"
myvar = "John" my-var = "John"
my_var = "John" my var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"
HGR, BPS. Page 2