Ticker

6/recent/ticker-posts

Introduction to Python Programming

Python, Python Logo, Python Programming, Black Logo

 Learning a new programming language isn't a very tedious work.You can just do it with making clear  understandings.

So here we have brought up a series of python tutorials for beginners to get familiar with python concepts.These are usually very simple to learn and understand.

    Basically Python is defined as high level programming language that has very wide applications in web designing , scripting AI and even more.Netflix ,Uber ,Pinterest are some famous social media websites built using python.Hence is in turn much productive.

    Apart from this, for many web applications , games ,software development and more.Python come with lots of libraries and frameworks .Flask, Django etc are some popular python frameworks.These are collection of packages and modules that helps to build web application.Python libraries are some reusable codes that avoid the problem of rewriting the whole scripts.The can be imported into our IDE using import keyword.


    In python simply to print anything , you just have to use the print function as follows -

   print(" Hello world! ") 

 ' \n ' can be used in the print statement to print anything in a new line.

   print( ' Hello \n World! ' )

>> Hello 

   World!

    Now you see here that there is no need to end every single line with a semicolon as in C or C++ language.Moreover there is no need to mention the datatype of any number as python is capable of automatically detecting the datatype when you give them.

    Variables in python allows you to assign values to it may it be integer any number or a string . They can be reassigned many times.Note that declaration of variable must follow certain rules. They must not begin with a number.And must only contain ,letters,numbers and underscores with no gaps or space between multiple words.

You can use a del statement to remove a variable.

    It is easy to carry out simple calculations using python.You do not need to specify the data type instead just input the numbers and operations.For example see below ;

>> 2 + 8

>> 10                 

 or 

 >> print(2+8) 

 >> 10

    Any operation like multiplication ,division and subtraction can also be performed using the * , /  , - sign respectively.Common datatypes we know are int - for integers , float for decimal point numbers ,bool for boolean,  etc .. Note that division by 0 will give an error,

    Besides these operations ,python also supports operations like exponentials using the ** symbol between the digits to be operated . Also the floor division method - the // symbol gives you the quotient of a division.The % operator is used to give you the remainder.

    And then there is string type  ,for texts. You can simply print string using the print function.But note that they have to be put inside single or double inverted commas.An error may occur if the beginning and ending inverted commas are different.

 print(' My name is XYZ ')    or   print ( " My name is XYZ")

    A backslash is used whenever to escape the characters like ' or " as these are already indicating the opening and closing of of string . Using these without an escape character ' / ' might generate confusion during compiling.

In python an input may be taken from the user using the input() function .For example ,

name= input('Enter your name :  ')

print(" Hi , " + name )

For input as integers or other datatypes you can mention it enclosing the input statement like       int (input ())  or    float(input())


So that was for basic python knowledge , later we will grow through some other concepts in python,Till then stay awaited.

Keep Learning !!


Post a Comment

0 Comments