0% found this document useful (0 votes)
2 views6 pages

Introduction to Python Programming

Python, created by Guido van Rossum in 1991, is a versatile programming language used for web development, software development, mathematics, and system scripting. It features a simple syntax that enhances readability and allows for rapid prototyping, running on various platforms. Python's unique indentation rules are crucial for defining code blocks, and it supports comments for documentation purposes.

Uploaded by

woonna.kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Introduction to Python Programming

Python, created by Guido van Rossum in 1991, is a versatile programming language used for web development, software development, mathematics, and system scripting. It features a simple syntax that enhances readability and allows for rapid prototyping, running on various platforms. Python's unique indentation rules are crucial for defining code blocks, and it supports comments for documentation purposes.

Uploaded by

woonna.kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Introduction of Python

Python was created by Guido van Rossum at the year of 1991.


1. Python is used for?
 Web Development that means server side.
 Software Development.
 Mathematics and
 System Scripting.
2. What can python do?
 It can be used on Servers to Create Web Applications.
 It can be used Alongside Software to create work flows.
 It can be connect to Data base systems. It can also read or modify files
 It can be used to handle the big data and perform complex Mathematics.
 It can be used for rapid prototyping, or for production-ready software Development.
3. Why python?
 Python works on different platforms like [Windows, Mac, Linux, Raspberry pi etc].
 Python has a simple syntax which is similar to English language.
 Python has the syntax which allows the developers to write programs which compared to other
programming languages.
 It runs on a interpreter system, that means the code can be executed as soon as written that means
prototyping can be very quick.
 Python can be treated as a functional way.
4. Python syntax compared to other programming languages?
 It was designed for readability, and has some similarities to the English language with influence
from mathematics.
 It uses new lines to complete a commend, as opposed to other programming languages which
often use semicolons or parentheses.
 It relies on indentation, using whitespace, to define scope, such as the scope of loops, functions
and classes. Other programming languages often use curly-brackets for this purpose.

Input: Output:
 To Check Whether python is installed in pc or not:
 To check if you have python installed on a Windows PC, search in the start bar for
Python or run the following on the Command Line ([Link]).
 In Windows Command Screen will be

 In Mac or Linux Command screen will be


Python Quick Start:


 Python is an interpreted programming language, this means developer can write
Python(.py) files in a text editor and then put those files into the Python interpreter to be
executed.
 The way to write a python file is like this in a command line.

 Where "[Link]" is the name of your python file.


Input:

Output at command and python software:


Python on Command Line:
 To test a short amount of code in python sometimes it is quickest and easiest not to write the code
in a file. This is made possible because Python can be run as a command line itself.
 Type the following on the Windows, Mac or Linux command line:

 Or, if the "python" command did not work, you can try "py":

 From there you can write any python

Input:

Output:

 Whenever you are done in the python command line, you can simply type the following to quit
the python command line interface:
Python Syntax
Execute Python Syntax
 Python syntax can be executed by writing directly in the Command Line:

 Or by creating a python file on the server, using the .py file extension, and running it in the
Command Line:

Python Indentation
 Indentation refers to the spaces at the beginning of a code line.
 Where in other programming languages the indentation in code is for readability only, the
indentation in Python is very important.
 Python uses indentation to indicate a block of code.
 Example:

 Python will give you an error if you skip the indentation:


 Syntax Error:

 The number of spaces is up to you as a programmer, the most common use is four, but it has to be
at least one.

 Output:

 You have to use the same number of spaces in the same block of code, otherwise Python will give
you an error:
 Syntax Error:

Python Variables
 In Python, variables are created when you assign a value to it:
 Example:

 Output:

Python Comments
 Python has commenting capability for the purpose of in-code documentation.
 Comments start with a #, and Python will render the rest of the line as a comment:

Input: Output:

 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.

Creating a Comment
 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:
 A comment does not have to be text that explains the code, it can also be used to prevent
Python from executing code:
 Input:

 Output:

Multiline Comments
 Python does not really have a syntax for multiline comments.
To add a multiline comment you could insert a # for each line:
 Or, not quite as intended, you can use a multiline string.
 Since Python will ignore string literals that are not assigned to a variable, you can add
a multiline string (triple quotes) in your code, and place your comment inside it:

You might also like