Loading...

Category: Python

Logical Operator

Logical Operators are and, or, not For Boolean Types: and ==> If both arguments are True then the result is True or ==>If one argument is True then the result [ … ]

Arithmetic Operators

Arithmetic Operators are the operators which perform arithmetic operations like, +==>Addition -==>Subtraction *==>Multiplication /==>Division %==>Modulo //==>Floor Division Operator **==>Exponent Or Power Operator Example: a=20 b=4 print(‘a+b=’,a+b) print(‘a-b=’,a-b) print(‘a*b=’,a*b) print(‘a/b=’,a/b) print(‘a//b=’,a//b) [ … ]

Operators

Operator is a symbol that perform certain operations. Python provides certain operators Arithmetic Operators Relational Operators Or Comparison Operators Logical Operators Bitwise Operators Assignment Operators Special Operators  

Constants

Constants concept is not applicable in Python. But only upper case characters are used if we don’t want to change values. MAX_VALUE=10 It is convenient but we can change the [ … ]

Escape Character

In String literals we can use escape characters to associate a special meaning. The following are various important escape characters in Python \n==>New Line \t==>Horizontal Tab \r==>Carriage Return \b==>Back Space [ … ]

None Data Type

None means Nothing or No value associated. If no values are available then None Data type is used. It is like null value in java. Example: def m1(): a=10 print(m(1)) [ … ]

dict Data Type:

To represent group of values as key value pairs dict data type is used. Example: d={101:”Rahul’,201:’Raju’,301:’Rakesh’} Duplicate keys are not allowed but values can be duplicated. If we are trying [ … ]

frozenset Data Type

It is same as set except that is is immutable. So, we cannot use add or remove functions. 1.>>>a={5,10,15,20} >>>fs=frozenset(a) >>>type(fs) <class ‘frozenset’> >>>fs frozenset({20,10,5,15}) >>>for i in fs:print(i) ………. [ … ]