Python Modules:We use modules to break down large programs into small manageable and organised files. We cannot keep on writing large programs in one python file. This approach may pose challenges like maintaining the code, debugging and few others. Using only one file for entire program may work for small programs and when only one … Continue reading Learning Python Part-20: Python Modules and Python Package
Category: Programming
Python Learning Part-19: Python Operators
Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand, for example, 2+3 output will be 5. here + is operator, 2,3 are operands and 5 is output.Since we have already used some of these operators by now in previous posts earlier, I … Continue reading Python Learning Part-19: Python Operators
Learning Python Part-18: Python Data Type Conversion
The process of converting the value of one data type (integer, string, float) to another data type is called type conversion. Python has two types of type conversion.Implicit Type ConversionIn Implicit type conversion, Python automatically converts one data type to another data type. This process doesn't need any user involvement.Python avoids the loss of data in Implicit … Continue reading Learning Python Part-18: Python Data Type Conversion
Learning Python Part-17: Python Dictionary
Dictionary in Python, is an unordered collection of 'key' and 'value' pairs. It is generally used when we have a huge amount of data. Some sample example use cases like Employee data or phonebook where we can use dictionaries in Python. Dictionaries are optimised for retrieving data. We must know the key to retrieve the … Continue reading Learning Python Part-17: Python Dictionary
Learning Python Part-16: Python Sets along with Frozenset
Python sets are unordered collection of unique items unlike lists or tuples. Python sets are defined by values separated by comma inside curly braces {}. The sets are mutable so we can add or remove elements to/from it. However, elements in a set are not ordered.Example:a = {1, 2, 3, 4, 5}print(a) … Continue reading Learning Python Part-16: Python Sets along with Frozenset
Learning Python Part-15: Python Tuples
Tuple is an ordered sequence of items just like what we discussed in previous post on Python lists.The only difference between a Tuple and a list is that tuples are immutable. Tuples once created cannot be modified.Tuples are used to write-protect data, where you do not want data to be changed in your program. Due to … Continue reading Learning Python Part-15: Python Tuples
Learning Python Part-14: Python lists
Python lists are similar to arrays in programming languages like C, C++ or Java. Lists are a useful tool for preserving a sequence of data and further iterating over it. However, Python lists are more flexible compared to them. Python list:Elements in a list do not require to be of the same type. It can be a mixture … Continue reading Learning Python Part-14: Python lists