Search This Blog

Sunday, May 24, 2020

Tokens and Data type in Python Programming

Python Programming:

In this tutorial, you will learn:-

      Token:

 


 

 

The smallest individual unit in a program is known as token in python.

There are 5 types of token available in python programming:-

1. Identifiers:-

An identifier is a name used to identify a variable, function, modules, or another object, etc.

Rules:-

* Identifiers can be a combination of letters  in lowercase(a to z) and uppercase(A to Z) or digit(0  to 9) or an underscore(_)
* Identifiers can't be stored with digit.
* Keywords can't be used as an identifier.
* Special symbol like : !, @, #, $, %,etc are use as identifiers.
* Identifier can be of any length.

2. Keyword:-

Keyword is a reserved words that have a special meaning in python programming
 * Keywords can't be used as identifiers.
* Python 3.7 has 33 keywords.
* All keywords except true, false, & name are the lower case and they must be written at it is.3.

 3. Operator:-

Operator are sign which is used to generate an expression or to perform any calculation. Python uses a nonalphanumeric character and character combination as an operator.
please visit our operator post to get more information, python operator.
For example:-   x+y=c;    ----- Airthmatic operator.

4. Delimiters:

Delimiters are the symbols and symbols combinations used in expression like list, dictionaries, string, etc.
For Example:-  {, }, [, ], :, =, +=,>>,etc

5. literals:-

A literals is a numbers or string that appears in a programming.
For example:-   
42  ---  Integer type   (literals)
29.8 ---- float 
"codeswithabhi"  -----string
12+i     --- complex

 Data type:-

  

1. None:

In this data type not any value stored means null value carries none data type.

2. Numeric:

* Integer:

In integer we have to take all values in integer data type.
For e.g:  >> abhi=10   ---int value
if we wanna confirm our data type so, you can use this function to check to check type of data type:
>> type(a)
<class'int'>

* Float:-

In this type of data type, we have to take all values in floating values (Decimal values).
For eample:      >>c=10.34  ---- Float value
If we wnna check type of data type that we takes type function :
>>Type(c)
<class'float'>

* Complex:

The complex data type holds the comples data type.
For exmple:   a=100+3k
print("type of data type",a  type(a))
<class'comple'>

* Boolean:

The boolen check the condition of two variables and also comparing two values.
For example:
>>a=10
>>b=100
>>a>b
>> False

3.  List :

In python we can create and also store data, and this data may be in integer, flaot, string, also combination of all 3 types of data type:
For Example:  >>abc[1,2,3]
        type (abc)
   <class'list'>
We discuss list in brief in our next post..

4. Tuple :

It is colllection of objects enclosed within ( ).
For example: >> a= (9,1,2)
          >>type(a)
      >> <class'tuple'>

There are some charactrstics of tuple:

* Hetrogeneous :
* Immutable :
 * Duplicate
We will discuss more in detail in our next upcomming post...

5. Set :

A set is an un oredered collection of items, Every set element is unique (no duplicates)p and cannot be changed.
For example:    >> A=(1,2,4,1,7,2)
>>print(A)
>>1,2,4,7    ----- here repeating number is avoid by set
And if we wanna check type of set:
>>Type(A)
>> <class'set'>
We discuss this topic in detail in our next upcomming post.

6. String :

The group of character is know as string. In pytho we can eaisly access string rather than another various programming language.
For example:
>> S="codeswithabhi"
Print(S)
codeswithabhi
And we can also check it by using type function
>>type(S)
<class' string'>

Learn complete Complete course





7. Range:

In other programming language we use loops and give condition to access a particular condition which is given by programmer, similary range gives a also a path, condition, and printing range.
For example:
>>Range(1,10) 
 So, in this condition interpreter print only 1 to 9.

8. Dictionary:-

Dictinary in python is an un ordered collection of data values , used to store data values like a map, for every values assign a key.
For example: 
>>d={'abhi':'codes','hello':'abhi'}
>>d.key
>>dict.key(['abhi':'codes'])  -- so here we print key
d values 
dict.values(['hello':'abhi')    ---here we print values.


Thanks for reading....

If you any doubt related this topic please drop your question in comment box.

Mr. abhijeet dwivedi

Developer

Hey, I'm Abhijeet

0 comments:

Post a Comment

If you have any doubt, please let me know