Lambda functions are small and anonymous functions. Lambda function can take ‘n‘ number of arguments, but will have only one expression. To create a Lambda function in Python, we need use Lambda keyword. Let’s see with an example. If we assign a function to a variable, it becomes an anonymous function and thus a lambdaContinue reading “Lambda Functions”
Author Archives: Hepsi Paul
Functions Again
ArgumentsConsider our previous function that was created that takes two parameters, num1 and num2. So, while calling the function we need to pass the same number of parameters i.e., if the function definition has two parameters, we need to pass two values, if the function definition has three parameters, we need to pass three values.Continue reading “Functions Again”
Functions
Functions are logical grouping of code statements that collectively performs a specific operation or a specific requirement. Example: If I am building a calculator, a calculator can perform various mathematical operations like addition, subtraction, division, etc. I can create one function for addition, one function for subtraction, one function for division, and so on. Let’sContinue reading “Functions”
For Loop
As it says in the header, FOR LOOP is used when we want to execute block of code statements again and again until a condition is met, we can use For loops. To be very specific, to iterate any collections, like a list, tuples, etc. we can use For loops. Example: Let’s understand FOR LoopContinue reading “For Loop”
While Loop
While Loops can be used if we need to execute the same set of statements again and again until a condition is met. For example, if we need to print a statement 5 times, we can use while loop. Let’s try to understand with an example: Example: Let’s try to print the value of variableContinue reading “While Loop”
If Statements
Well, if statement is common across many programming languages. When we have scenario, that an action should be performed only after a condition is satisfied, we can use if statement. For example, when a person is trying to login into his gmail account, he has to give his user name and password to validate andContinue reading “If Statements”
Dictionaries Again
We saw in the previous posts how to retrieve items from Dictionaries. Now, let’s learn other operations associated with Dictionaries in Python. Length of Dictionaries We have created a dictionary called as personDict. We can find the length of Dictionaries as shown below. Example: Output: This will display the number of items in a dictionary.Continue reading “Dictionaries Again”
Dictionaries
Dictionaries are a bag of key value pairs which is written inside two curly braces. It is a collection of key values pairs that is not ordered, can be changeable and can be indexed. Rather than indexes, in any other collections like lists, arrays, etc., items can be obtained via Key. Now let’s see howContinue reading “Dictionaries”
Strings Formatting
Strings in Python is very much similar like the usage in other languages. I am going to point out the most important ways of strings formatting which is little different in Python. Assume that there is a scenario, where you are getting a value from a method and the value that is returned from theContinue reading “Strings Formatting”
SETs
Basic explanation of usage of sets in Python