PYTHON

Introduction to Python

Python is a general purpose and  heigh level programming language. The Python language developed by Guido Van Rossum in 1991. Python language supported OOPs( Object Oriented Programming) concepts which provide OOPs features, which helps in creating many Software, Games.
In Python We can create programs easily. 


Features of Python

There are 7 features which supported by python language listed below:-
  1. Essay to Learn and use:- Python is essay to learn and use because it is heigh level language , it means we don't need any syntax to write and create the program.
  2. Interpreted language :-  python uses Interpreted and it  convert our program or code into machine language line by line. 
  3. Cross platform language:-  with this amazing feature we can run our python code on window to Linux , Window to Windows , and many operating systems.
  4. free and open source:- If you want to download and install python on your system so just visit on official python site( www.python.org/download).
  5. Support GUI:- Python support GUI(Graphical User Interface). We can create amazing GUI program with supported libraries.  We need import them and use. 
  6. Large Standard Library:- Python has large inbuild libraries which makes our  program  creative. 
  7. Support OOPs Concept:- Python supported Oops concept which provides lots of features such as:- data hiding , data binding , data security and more with class , object , polymorphism , encapsulation, etc. 

where use python-->

  • Web application development
  • Data science
  • Game development
  • Software development
  • Education sector

Installing Python

To download and install Python , you have to follow some common steps .
1) Go to your browser (Google )and search (www.python.org/download)
2) now click on python version according to requirement.

=> How to use IDLE  and Create and run the program:-

To create the  program in Python firstly you have to open IDLE ( Integrated Development Learning Environment) platform. 
 


  • after open IDLE platform we will create a python file with using CTRL + N and save the file with .py extension after type the file name such as . 👇




  • Now run the code with Run Module tool which is inside the Run tab.

Also you can Run your program with using Fn + F5 which is alternate shortcut key of Run Module.

Variable:-

Variable is box or a container which store the information of user. Every programming language need variable to store information. We should give meaningful name of variable like, name, age, course, and more.

How to create a Variable in Python

In python just we type the variable name, we don't need any datatype. After type the variable name we use assignment operator (=)to put the value inside the variable. like:-
name="Jyoti"
age=18
weight=56.78
In above variables  example store different values.
name="Jyoti" : - Where name is a variable and it contain the string value("Jyoti").
age=18:- Here age is variable name and it contain the integer value.
weight=56.78:- Here weight is a variable name and it store the decimal value.

Now we have to understand where use double inverted comma/double quotation mark . 
Whenever we put the string value( multiple character) then we always use double inverted comma.
fruit="mango"
course="python"
If you storing integer and decimal value inside the variable so don't use any inverted comma.

=> Python Variable Naming Rule:-

Lets understand the python variable naming rules
1) we can not use space while creating variable.
    username    (Correct)
    user name   (Incorrect)
2) While creating variable we can not use any numerical values such as:-
    course1        (Correct)
    1course        (Incorrect)
3) We can not use any arithmetic operator and special character but we can use underscore mark while creating a variable.
   user_age        (Correct)
   user-age        (Incorrect)
4) Python keywords are not allowed in variable name such as def, print, else , etc. 

=> Keywords in Python:- 

Keywords :- Keywords are pre-defined text that perform a particular task. they are reserved words.
such as:-
def             if        print        else        break        continue        import

Ture        false    and            or         not            pass                while

class        for       try            elif

=> How to display  any text :-

To display any text we use pre-defined print() function and type our text or statement inside parenthesis such as:-
print("hello python")
Example 1:- print the hello World! :-
 
example1.py program code image

Press Fn+F5 or F5 to run the program.

The output is :-









=> How to take input from the user:-

We can take input from user with using input() function .  
syntax:-
variable_name=input("enter your information here ")
but always remember we take different different type of information such as integer number , decimal number .
Whenever we take an integer  number from the user we use int() function before input() function .
variable_name=int(input("enter your data here "))

=> How to take decimal(point) number from the user:-

To take a decimal number from the user we use float() function before input() function.

variable_name=float(input("enter your data here"))

=> Operators in Python :- Operators are symbols which helps in Arithmetic and logical calculation. 

There are various types of operators. 

1) Arithmetic Operators :- Those operator calculate basic operations such as addition , subtraction and more.


=> How to create addition program in python:-


The output is 

use of all arithmetic operators in python:- 

num1=int(input("enter your first number "))
num2=int(input("enter your second number "))
print("the sum is ",num1+num2)
print("the subtraction  is ",num1-num2)
print("the multiplication  is ",num1*num2)
print("the division is ",num1/num2)
print("the integer floor  is ",num1//num2)
print("the modulus is  ",num1+num2)
print("the exponent is ",num1**num2)

The output is:-
enter your first number 12
enter your second number 2
the sum is  14
the subtraction  is  10
the multiplication  is  24
the division is  6.0
the integer floor  is  6
the modulus is   14
the exponent is  144


=> Relational operators in python:-

Those operators which helps in find the difference between  in two values that are called relational operators , it also known as Comparison operators.