Saturday, 27 October 2018

Basic Of Python

                                             Python_Basic



Que. How to assign value in python?
In Python, there is no need to assign data type. It automatically detects the data type.
For Example:
2+3
a=10
b=10
c=10
var=10
name="amit"
height= "5.86"

Que.  What is Token in Python?

  • Python Tokens (Identifier, Keywords, Literals, Operators)
  • In Python Identifier always start with an underscore (_)
          For Example:
                               _12key=10

  • Literals
  1. String Literals
name1 = "John"

name2 = "Rohit"
print name1
print name2
print name1+name2
print name1+" "+name2

Output

John
Rohit
JohnRohit
John Rohit

multiline = ' ' ' First Line
Second Line
Third Line
Fourth Line ' ' '
print multiline

Output
First Line
Second Line
Third Line
Fourth Line

2. Numeric Literals

Numeric Literals are Int, Long, Float, Complex

3. Boolean Literals
   True, False (Both are also keywords)
4. Special Literals
   None (It specify that the field is not created)

  • Operators
1. Arithmetic Operator
2. Logical Operator
3. Assignment Operator
4. Logical Operator
5.Membership Operator