4 || Identifiers, Keywords, Data types || Python Basic Full Course

This Lecture contain types of Identifies, List of keywords and List of data types with definitions of each type. Int value detail description.

4 || Identifiers, Keywords, Data types || Python Basic Full Course

The identifier in Python: 

The variable names, Method names, and Class names.

Rules to set identifiers: 

  1. a to z , A to Z , 0-9, _
  2. Starts with digit 
  3. Case sensitive 
  4. Reserved words as identifiers 
  5. No length limit

Special Cases: 

  • _x ===> private 
  • __x ===> strongly private 
  • __name__
  • __add__

Reserved Keywords in Python : 

There are 33 reserved words in python to represent some functionality are :

  • True, False, None 
  •  and, or, not, is 
  •  if, else, elif 
  •  while, for, continue, return, in, yield 
  • try, except, finally, raise, assert
  • import, from, as, class, def, pass, global, nonlocal, lambda, del, with 

Note :

  1. All reserved contains only symbols
  2. Except first 3 using the capital symbol 

Data Types  In Python:

14 types of  datatypes in python are listed below: 

  • int
  • float
  • complex
  • bool
  • str
  • bytes
  • bytearray
  • range
  • list
  • tuple
  • set
  • frozenset
  • dict
  • none

int : Contains only interger values like 10,20,100
float: contains only deicamal values like 1.25, 2.4
complex : contain complex number which have number in additin with complex value followed by (j)
bool : contains only two value true and false
str : If you want to represent String then we can use str
bytes : It returns a group of values which is non mutable
bytearray : It returns a group of values which is mutable
range : it contains range like 1 to 10, 2 to 500 and so on.
list : List of values Mutable
tuple : list of value but immutable 
set : A set is an unordered and unindexed collection of unique elements. Mutable in nature
frozenset : same as set but immutable in nature.
dict : A set of Key value pairs in braces.
none : A none keyword is used to define null value.

1) int datatype : 

Properties : int data type can only store interget values. 

example:  10, 20, 55, 89 etc. 

Code : 


a = 10
type(a)

Output:

<class ‘int’>

Types of interger values:

    • Decimal values
      • Type    : Decimal (Base-10)
      • Range   : 0 to 9
      • Example : a = 7878
    • Binary values
      • Type    : Binary (Base-2)
      • Range   : 0 to 1
      • Example : a =0B 1111 or a =0b 1111
    • Octal form values
      • Type    : Octal (Base-8)
      • Range   : 0 to 7
      • Example : a = 0o777
    • Hexa decimal values
      • Type    : Hexa decimal (Base - 16)
      • Range   : 0-9, a-f OR 0-9, A-F
      • Example : 0x or 0X

What's Your Reaction?

like
1
dislike
0
love
1
funny
0
angry
0
sad
0
wow
1