Python
1.1 Intro
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.
Python Features:
1) Easy-to-learn: few keywords, simple syntax.
2) Easy-to-read
3) Easy-to-maintain: source code is fairly easy-to-maintain.
4) Many libraries: Many of them are portable and cross-platform compatible.
5) Interactive Mode
6) Portable: has the same interface on all platforms.
7) Extendable
8) GUI Programming
9) Databases: Has interfaces to most of the databases.
1.2) Installation:
https://www.python.org/downloads/windows/ --> link to download
1.3) Python Prompt:
Go to command prompt
C:\Users\win10>python
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
In Python 3, print is a function and not a statement.
1.4) Script mode programming:
- create a file with python script and save as file2.py
- Execution: PS D:\0_python> py file2.py
1.5) Python Multiline statements
Python has new line continuation character "\".
city = "cities are with \
many shops \
with different variey of models."
print (city)
Statements within [], {}, or ()
brackets not required to use line continuation character.
city = ['bangalore',
'Hyderabad',
'chennai', 'Vijayawad',
'Tirupati', 'Coiambattore']
print (city)
O/p:
PS D:\0_python> py file2.py
['bangalore', 'Hyderabad', 'chennai', 'Vijayawad', 'Tirupati', 'Coiambattore']
1.6 Quotes in Python
Python has single ('), double (") and
triple (''' or """) quotes.
single_quote = 'word'
double_quote = "This is a sentence."
triple_quotes = """triple_quotes are used for
multiline statements."""
print (triple_quotes)
No comments:
Post a Comment