UNIT 1
BASICS OF PYTHON
1. PYTHON
Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.
It is used for:
web development (server-side),
software development,
mathematics,
system scripting.
What can Python do?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software
development.
Why Python is used
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.
Python runs on an interpreter system, meaning that code can be executed as
soon as it is written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-oriented way or a
functional way.
2. VARIABLES
A Python variable is a reserved memory location to store values. In other words,
a variable in a python program gives data to the computer for processing.
Every value in Python has a datatype. Different data types in Python are
Numbers,List, Tuple, Strings, Dictionary, etc. Variables can be declared by any
name or evenalphabets like a, aa, abc, etc
Variable Naming Rules in Python
Variable name should start with letter(a-zA-Z) or underscore (_).
In variable name, no special characters allowed other than underscore (_).
Variables are case sensitive.
Variable name can have numbers but not at the beginning.
Variable name should not be a Python keyword.Keywords are also called as
reserved words.
, How to Declare and use a Variable
Declare variable "a" and print it.
a=100
print (a)
Re-declare a Variable
a=100
print(a)
a=’AECS Jaduguda’
print(a)
Concatenate Variables
a='AECS'
b=1
print(a+b)
will throw error , as we cannot concatenate two different datatypes.
a='AECS'
b=1
print(a+str(b))
will display
AECS1
Delete a variable
You can also delete variable using the command del "variable name".
The below table displays the list of available assignment operators in Python
language.
3. EXECUTING PYTHON FROM COMMAND LINE
Methods to Run a Script in Python
There are various methods to Run a Python script, we will go through some generally
used methods for running a Python script:
Interactive Mode
Command Line
Text Editor (VS Code)
BASICS OF PYTHON
1. PYTHON
Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.
It is used for:
web development (server-side),
software development,
mathematics,
system scripting.
What can Python do?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software
development.
Why Python is used
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.
Python runs on an interpreter system, meaning that code can be executed as
soon as it is written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-oriented way or a
functional way.
2. VARIABLES
A Python variable is a reserved memory location to store values. In other words,
a variable in a python program gives data to the computer for processing.
Every value in Python has a datatype. Different data types in Python are
Numbers,List, Tuple, Strings, Dictionary, etc. Variables can be declared by any
name or evenalphabets like a, aa, abc, etc
Variable Naming Rules in Python
Variable name should start with letter(a-zA-Z) or underscore (_).
In variable name, no special characters allowed other than underscore (_).
Variables are case sensitive.
Variable name can have numbers but not at the beginning.
Variable name should not be a Python keyword.Keywords are also called as
reserved words.
, How to Declare and use a Variable
Declare variable "a" and print it.
a=100
print (a)
Re-declare a Variable
a=100
print(a)
a=’AECS Jaduguda’
print(a)
Concatenate Variables
a='AECS'
b=1
print(a+b)
will throw error , as we cannot concatenate two different datatypes.
a='AECS'
b=1
print(a+str(b))
will display
AECS1
Delete a variable
You can also delete variable using the command del "variable name".
The below table displays the list of available assignment operators in Python
language.
3. EXECUTING PYTHON FROM COMMAND LINE
Methods to Run a Script in Python
There are various methods to Run a Python script, we will go through some generally
used methods for running a Python script:
Interactive Mode
Command Line
Text Editor (VS Code)