Category: Python note

python tutorials and learn python

Created with Sketch.

Python Logical Operators: and, or, not

Python Logical Operators: and, or, not We can apply for all types. For boolean Types Behaviour:and –> If both arguments are True then only result is Trueor –> If at least one arugemnt is True then result is Truenot –> ComplementTrue and False –> FalseTrue or False –> Truenot False –> True For non-boolean Types…
Read more

Python OPERATORS (PYTHON FUNDAMENTALS)

Python OPERATORS  The operator is a symbol that performs certain operations.  Python provides the following set of operators             1) Arithmetic Operators            2) Relational Operators OR Comparison Operators            3) Logical operators            4) Bitwise operators   …
Read more

Python Escape Characters (PYTHON FUNDAMENTALS)

Python Escape Characters In String literals, we can use escape characters to associate a special meaning. The following are various important escape characters in Python1) \n —> New Line2) \t —> Horizontal Tab3) \r —> Carriage Return4) \b —> BackSpace5) \f —> Form Feed6) \v —> Vertical Tab7) \’ —> Single Quote8) \” —> Double…
Read more

Python None Data Type (PYTHON FUNDAMENTALS)

None Data Type  None means nothing or No value associated. If the value is not available, then to handle such types of cases None is introduced. It is something like a null value in Java. Eg:def m1():a=10print(m1())None

Summary of Datatypes in Python 3

Datatype Description Is Immutable? Example Int We can use to represent the whole/integral numbers Immutable >>> a=10 >>> type(a) <class ‘int’> Float We can use to represent the decimal/floating point numbers Immutable >> b=10.5 >>> type(b) <class ‘float’> Complex We can use to represent the complex numbers Immutable >> c=10+5j >> type(c) <class ‘complex’> >>>…
Read more

Python dict Data Type (PYTHON FUNDAMENTALS)

Python dict Data Type If we want to represent a group of values as key-value pairs then we should go for dict data type. Eg: d = {101:’durga’,102:’ravi’,103:’shiva’} Duplicate keys are not allowed but values can be duplicated. If we are trying to insert an entry with the duplicate key then old value will be…
Read more

Python frozenset Data Type (PYTHON FUNDAMENTALS)

It is exactly the same as set except that it is immutable.  Hence we cannot use add or remove functions.

Python set Data Type (PYTHON FUNDAMENTALS)

Python set Data Type: If we want to represent a group of values without duplicates where the order is not important then we should go for set Data Type.1) Insertion order is not preserved2) Duplicates are not allowed3) Heterogeneous objects are allowed4) Index concept is not applicable5) It is a mutable collection6) Growable in nature…
Read more

Python byte array Data Type (PYTHON FUNDAMENTALS)

bytearray is exactly same as bytes data type except that its elements can be modified. Eg 2:

Python bytes Data Type

bytes Data Type bytes data type represents a group of byte numbers just like an array. Conclusion 1: The only allowed values for byte data type are 0 to 256. By mistake, if we are trying to provide any other values then we will get a value error. Conclusion 2: Once we create a bytes…
Read more