Python Course

Author : reshmanikki
Publish Date : 2021-02-17 12:24:24
Python Course

Python is an open-source programming language created by Dutch programmer Guido van Rossum and named after the British sketch comedy group, Monty Python’s Flying Circus. One of van Rossum’s key insights was that programmers spend more time reading code than writing it, so he created an easy-to-read language. Python Course is one of the most popular and easiest to learn programming languages in the world. It runs on all the major operating systems and computers and is used in everything from building web servers to creating desktop applications. Because of its popularity, there is a large demand for Python programmers.  

Installing Python:

http://python.org/downloads and https://jupyter.org/install.html for windows and IOS.

If you are on Ubuntu, Python 3 comes installed by default.

Syntax:

In Python, strings are always surrounded by quotes. This is an example Python’s syntax.

The following is a valid Python program: print("Hello, World!")

Python Syntax Rules:

1. Python is case sensitive. Hence a variable with name yoyostudy is not same

as yoYoStudy.

2. For path specification, python uses forward slashes. Hence if you are working with a

file, the default path for the file in case of Windows OS will have backward slashes,

which you will have to convert to forward slashes to make them work in your python script. For window's path C:folderAfolderB relative python program path should be C:/folderA/folderB. 3. In python, there is no command terminator, which means no semicolon ; or

anything.

4. In python, you can use single quotes '', double quotes "" and even triple quotes '''

""" to represent string literals.

5. Code Indentation: This is the most important rule of python programming. In

programming language like Java, C or C++, generally curly brackets { } are used to define a code block, but python doesn't use brackets, then how does python knows where a particular code block ends. Well python used indentation for this. It is recommended to use tab for indentation, although you can use spaces for indentation as well, just keep in mind that the amount of indentation for a single code block should be same.

Example:

if True:

# this is inside if block

print "Yes, I am in if block"

print "me too"

Constructing a List:

>>> myEmptyList = []

For example, list of some integers will be,

>>> myIntegerList = [9, 4, 3, 2, 8]

Creating a Dictionary:

A dictionary in python can be created as:

>>> myDictionary = {'Key-1': 'Element-1', 'Key-2': 'Element-2', 'Key-3': 'Element- 3', 'Key-4': 'Element-4'}

Tuples in Python:

Tuples are a lot like lists, and that's why we can define them in a pretty similar way as we did to define the lists. Simply put, a tuple is a sequence of data.

Defining a Tuple:

To define a tuple, we just have to assign a single variable with multiple values separated by commas, and that variable will be known as a Tuple.

>>> myTuple = 1, 2, 3, 4

>>> print myTuple

The for loop:

Syntax:

for [ELEMENT] in [ITERATIVE-LIST]:

[statement to execute]

else:

[statement to execute when loop is over]

[else statement is completely optional]

Example:

>>> myList = [8, 9, 2, 3, 4, 6]

If we want to iterate all the elements of the list myList using the for loop:

for i in myList:

print i

The while loop:

Syntax:

while [condition]:

[statement to execute]

else:

[statement to execute if condition is false]

[else statement is completely optional]

Example:

i = 0

while i < 5:

i=i+1

print "i =", i



Category : general

New Reliable Nutanix Ne Reliable NCA-5.15 Exam PDF Dumps

New Reliable Nutanix Ne Reliable NCA-5.15 Exam PDF Dumps

- You need to prepare from the updated Nutanix NCA-5.15 dumps to go through the Nutanix Certified Associate (NCA) 5.15 test in the principle attempt.


The six men disappeared from history until now

The six men disappeared from history until now

- Only one of the lifeboats that escaped the sinking ship turned back to search for potential survivors. In the darkness, the rescuers found a young Chinese man


NEWS Covid-19 : quarantaine imposée pour les voyageurs du Brésil, dArgentine, du Chili et dAfrique du S

NEWS Covid-19 : quarantaine imposée pour les voyageurs du Brésil, dArgentine, du Chili et dAfrique du S

- ISOLEMENT - En raison de la montée en flèche des variants, une quarantaine de dix jours sera désormais obligatoire pour tous les voyageurs


The Future of SAP C_TAW12_750 Certification

The Future of SAP C_TAW12_750 Certification

- Many companies and institutions are offering these certificates and among these companies Salesforce is the most famous company