Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Getting Started With Python

Uploaded by

Shravan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Getting Started With Python

Uploaded by

Shravan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Getting Started With Python

● Python programming language was developed by Guido Van Rossum in February 1991.
● It was named after the famous BBC comedy show Namely Monty Python's Flying Circus.
● Python was based with two Rossum on in February 1991 or influenced with 2
programming languages.
○ ABC language, a teaching Language created. as replacement of BASIC, and.
○ Modula-3

● Pluses of Python:
○ Easy to use - Python is a compact and very easy to use object-oriented language
with very simple syntax rules. It is a very high-level language and it is thus
very-very programmer-friendly.
○ Expressive Language - Python is an expressive language - fewer lines of code
and simpler syntax. For example, consider the following two sets of code:

➔ In C++: Swap Values ➔ In Python: Swap Values

int a=2, b=3 tmp; a,b=2,3


tmp = a; a,b=b,a
a=b
b=tmp;

○ Interpreted language - Python is an interpreted language, not a compiled


language. it makes Python an easy-to-debug language and thus suitable for
beginners to advanced users.
○ Its completeness - For most types of the required functionality is available
through to various modulus of Python Standard Library.
For example - for diverse functions such as emails, web pages, databases, GUI
development, network connections and many more, everything is available in the
Python Standard Library. Thus, it is also called - “Python follows batteries
included philosophy”.
○ Cross-platform language: Python can run equally well on a variety of platforms -
Windows, Linux/ Unix/ Macintosh, supercomputers, smartphones, et cetera.
And that makes python a true cross-platform language. Or in other words, Python
is a portable language.
○ Free and open-source: Python language is freely available along with its source
code.
○ Variety of usage/applications: Python has award into a powerful, complete
language over these years. These days Python is being used in many diverse
fields/ applications, some of them are listed below.
■ Scripting
■ Web applications
■ Game development
■ Database applications
■ System administration
■ Rapid prototyping
■ GUI programs

● Python - Some disadvantages:


○ Although Python is a very powerful yet simple language with so many
advantages, it is not the perfect programming language.
○ Not the fastest language: Python is interpreted language not a fully compiled one.
Fully compiled languages are faster than their integrated counterparts. So
Python offers faster development times but execution times are not that fast
compared to some compiled languages.
○ Lesser libraries than C, Java, Perl: Python offers library support for almost all
computer programs, but its library is still not competent with languages like C,
Java, Perl as they have the larger collection available. Sometimes in some
cases, these languages offer better and multiple solutions than python.
○ Not strong on type-binding: Python interpreter is not very strong on catching
Type-mismatch issues. For example, if you declare a variable as an integer but
later store a string value in it Python won't complain or pinpointed.
○ Not easily convertible: Because of its lack of syntax, Python is an easy language
to program in. But these advantages have a flip side too. It becomes a
disadvantage when it comes to translating a program into another programming
language. this is because most other languages have structural defined Sentex

# NOTE:- Python is an interpreted language, that is, all the commands you write are interpreted
and executed one by one.

● Modes of Python: There are two modes of Python:


○ Script mode: This is the mode where the scripted and finished “.py“ files are run
in the Python interpreter.
○ Interactive mode: this is a command-line shell that gives immediate feedback for
each statement while running previously fed statements in active memory.

● Analysing Script and Output:

Input:

#My First Program


print(“Hello World!”)

Output:

Hello World!
We wrote two statements but the output was only one sentence. The reason is that any
line that begins with a “#” symbol is a comment in Python. That is, it is for The
programmer’s understanding/information only; Python will completely ignore all the lines
starting with a #.

● Understanding print():

To print or display output, Python 3x provides the print() function. The print() function can
be used as:
print(<objects to be printed>)
For example,

>>> print(“Hello World”)

It prints,

Hello World

Similarly to print other strings you may give something like,

>>> print(‘My name is Suresh’)

It will print,

My name is Suresh

Both these strings are valid in Python. Strings can be enclosed in double-quotes or in
single quotes but it has to be ensured that the closing and the opening quotes are of the
same type.

‘Hey there” #will result in an error

You might also like