##### Lesson Details:
June 29, 2020

I: Introduction

The Python programming language is an interpreted, interactive, object-oriented programming language. This is a high level language and is designed to be easy to read and write (easy to learn). Its syntax is very different from most other languages and is designed not to be too verbose. A big benefit of this is that it is often easier to find the solution to a problem in Python than in other languages.

This tutorial will introduce you to python and its various concepts and constructs.

II: Body

1: Learn basic python programming for beginners

1.1: Variables and Strings

In python variables do not need any declaration. However if you declare them, they will be automatically initialized with their default value. For example:

We can assign values to variables using assignment statement. The following statement assign the value ‘Hello’ to variable name :

#!/usr/bin/python name = ‘Hello’ print(name)

When the above code is executed, it produces the following result:

Hello

Python variables can also hold string values. They are enclosed within quotation marks. For example:

name = "Hello World!" print("Your name is : ", name)

When the above code is executed, it produces the following result:

Your name is : Hello World!

1.2: Data Types in Python

Python programming language supports six primitive data types. They are Numeric types, String types, Sequence types, Mapping types, Set types and Boolean types. We will examine each one of these data types one by one.

1.2.1: Numeric Types

Python supports two numeric types: integers and floating point numbers. Integer numbers are whole numbers with no fractional component. On the other hand, floating point numbers are used for fractional values. Both these numeric types can be written in either decimal or hexadecimal format. We have already seen how you can assign numeric values to your program variables using either decimal or hexadecimal format. There are various ways of declaring numeric constants in python: Let us consider few examples to understand this concept better:

a) Writing numbers in Decimal Form: Here are some examples of decimal numbers: 1, 583254523, 6000000000000000000 etc. We can write these numbers in our programs like this:

num1 = 100 num2 = 103254523 / 100000 num3 = 6000000000000000000L / 1000000L #Convert large integer literal into long print(num3)

When the above code is executed, it produces the following output:

6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L 6000000000000000000L

b) Writing Numbers in Hexadecimal Form: Hexadecimal numbers can be written as 0x prefix followed by hexadecimal digits. We can write these numbers in our programs like this:

num4 = 0xDEADBEEF num5 = 0xDEADBEEF / 0x7F num6 = 0xDEADBEEF / 0x7FFF num7 = 0xDEADBEEF / 0xFFFFF #Convert large integer literal into long print(num7) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7fffffffffffffff) #print hex value of number 7FFFFFFFFFFFFFFF print(0x7ff0000000000000) #hex equivalent for decimal number 706446783204769005120705433305008908404496831850313951727146723382975900813963799604635553861090588369964268155910559240516631477774691274107988453465285821693057388265225688052152139953904381827676613925775444482205638915983516210332102583679762352931810622118861119627474669412107412603464230865552348767610524560599979997404907376555234876761052456059997999740490737655523487676105245605999799974049073765552348767610524560599979997404907376555234876761052456059997999740490737655523487676105245605999799974049073765552348767610524560599979997404907376555234876761052456056...