Python Introduction

What is Python? Python is a prevalent programming Language. It was made in 1991 by Guido van Rossum. It is utilized for: web improvement (server-side), software improvement, mathematics, System...

What is Python?

Python is a prevalent programming Language. It was made in 1991 by Guido van Rossum.

It is utilized for:

  • web improvement (server-side),
  • software improvement,
  • mathematics,
  • System scripting.

What would python be able to do?

  • Python can be utilized on a server to make web applications.
  • Python can be utilized close by programming to make work processes.
  • Python can associate with database frameworks. It can likewise read and change documents.
  • Python can be utilized to deal with huge information and perform complex science.
  • Python can be utilized for fast prototyping, or for generation prepared programming advancement.

Why Python?

  • Python takes a shot at various stages (Windows, Mac, Linux, Raspberry Pi, and so on).
  • Python has a straightforward grammar like the English dialect.
  • Python has a linguistic structure that enables engineers to compose programs with fewer lines than some other programming dialects.
  • Python keeps running on a translator framework, implying that code can be executed when it is composed. This implies prototyping can be snappy.
  • Python can be dealt with procedurally, a protest orientated way or a useful way.

Great to know

  • The latest real form of Python will be Python 3, which we will use in this instructional exercise. Nonetheless, Python 2, despite the fact that not being refreshed with something besides security refreshes, is still very prominent.
  • In this instructional exercise, Python will be composed in a content tool. It is conceivable to compose Python in an Integrated Development Environment, for example, Thonny, Pycharm, Netbeans or Eclipse which are especially valuable while overseeing bigger accumulations of Python records.

Python Syntax contrasted with other programming dialects

  • Python was intended to for meaningfulness and has a few similitudes to the English dialect with impact from arithmetic.
  • Python utilizes new lines to finish an order, instead of other programming dialects which frequently utilize semicolons or brackets.
  • Python depends on space, utilizing whitespace, to characterize scope, for example, the extent of circles, capacities, and classes. Other programming dialects regularly utilize wavy sections for this reason.

Python Syntax

Execute Python Syntax

As we learned in the past page, Python language structure can be executed by composing straightforwardly in the Command Line:

>>> print(“Hello, World!”)

Hi, World!

Python Variables

Making Variables

Dissimilar to other programming Languages, Python has no command for declaring a variable.

Variable Names

A variable can have a short name (like x and y) or a more distinct name (age, carname, total_volume). Standards for Python factors:

  • A variable name must begin with a letter or the underscore character
  • A variable name can’t begin with a number
  • A variable name can just contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-touchy (age, Age, and AGE are three distinct factors)

Python Numbers

Python Numbers

There are three numeric composes in Python:

  • int
  • float
  • complex

Int

Int, or number, is an entire number, positive or negative, without decimals, of boundless length

Float

Float or “coasting point number” is a number, positive or negative, containing at least one decimals.

Complex

Complex numbers are composed with a “j” as the nonexistent part:

Python Casting

Indicate a Variable Type

There might be times when you need to indicate a sort on to a variable. This should be possible with throwing. Python is a protest orientated dialect, and in that capacity, it utilizes classes to characterize information composes, including its crude kinds.

Throwing in python is along these lines done utilizing constructor capacities:

  • int() – develops a whole number from a whole number strict, a buoy exacting (by adjusting down to the past entire number) strict, or a string strict (giving the string speaks to an entire number)
  • float() – develops a buoy number from a whole number exacting, a buoy strict or a string strict (giving the string speaks to a buoy or a number)
  • str() – develops a string from a wide assortment of information composes, including strings, whole number literals and buoy literals

Python Arithmetic Operators

Python Arithmetic Operators

Arithmetic operators are used with numeric values to perform common mathematical operations:

Operator ………………..Name ………………..Example 


……………….. Addition ……………….. x + y

– ……………….. Subtraction ……………….. x — y

………………..Multiplication ……………….. x * y

……………….. Division ……………….. x / y

……………….. Modulus ……………….. x % y

** ……………….. Exponentiation ………………..x ** y

// ……………….. Floor division ……………….. x // y

Python Assignment Operators

Assignment operators are used to assign values to variables:

Operator ………… Example ………………..Same As 


…………………… x = 5 ……………………. x = 5 


+= 
………………… x += 3 ……………….. x = x + 3 


-= 
…………………. x -= 3 …………………. x = x — 3 


*= 
…………………. x *= 3 ……………….. x = x * 3 


/= 
…………………. x /= 3 ……………….. x = x / 3 


%= 
……………….. x %= 3 ……………….. x = x % 3

 
//= 
……………….. x //= 3 ……………….. x = x // 3 


**= 
……………….. x **= 3 ……………….. x = x ** 3

 
&= 
……………….. x &= 3 ……………….. x = x & 3 


|= 
……………….. x |= 3 …………………. x = x | 3


^= 
………………..x ^= 3 ……………….. x = x ^ 3 


>>= 
……………….. x >>= 3 ……………….. x = x >> 3 


<<=
 ……………….. x <<= 3 ……………….. x = x << 3

Python Comparison Operators

Comparison operators are used to compare two values:

Operator ……………Name …………………………. Example 


==
 ………………..Equal ……………….. ……………. x == y 


!= ………………..Not equal …………………………… x != y

………………..Greater than ……………….………. x > y 


………………..Less than ……………….…………… x < y 


>= ………………..Greater than or equal to …………. x >= y

<= ………………..Less than or equal to ……………… x <= y

Python Logical Operators

Logical operators are used to combine conditional statements:

Operator ……………….. Description ………………..Example 


and …… Returns True if both statements are true ………x < 5 and x < 10 


or ………Returns True if one of the statements is true ……… x < 5 or x < 4

not ……..Reverse the result, returns False if the result is true  not(x < 5 and x < 10)

Python Identity Operators


Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location:

Operator ……………….. Description ………………..Example 


is ……… Returns true if both variables are the same object ………..x is y 


is …… not Returns true if both variables are not the same object… x is not y

Python Membership Operators

Membership operators are used to test if a sequence is presented in an object:

Operator…………… Description ……………………..Example 


in ……………….. Returns True if a sequence with the specified value is present in the object …………………………………… x in y 


not in ………………..Returns True if a sequence with the specified value is not present in the object ………………………………… x not in y

Python Bitwise Operators

Logical operators are used to combine conditional statements:

Operator ……………….. Name ……………….. Description


&
 ……………….. AND …………… Sets each bit to 1 if both bits are 1


………………..OR ……………… Sets each bit to 1 if one of two bits is 1


^
 ………………..XOR ……… Sets each bit to 1 if only one of two bits is 1


~
 ………………..NOT ………………..Inverts all the bits


<<
 ………………..Zero fill left shift ………………..Shift left by pushing c zeros in from the right and let the leftmost bits fall off


>>
 ………………..Signed right ………………..shift Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off

Python Training in Chennai @ Greens Technology

  • If you are seeking to get a good Python Training in Chennai, then Greens Technologys should be the first and the foremost option.
  • We are named as the best training institute in Chennai for providing the IT related training. Greens Technologys is already having an eminent name in Chennai for providing the best software courses training.
  • Rated as №1 Leading Python Training Institute in Chennai offering classroom training, practical training, and online training.
Categories
Education
No Comment

Leave a Reply

*

*