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”

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”

Complex Number

A Complex number is a combination of real number and an imaginary number. For example: 3 + 2i –> This is a complex number in which 3 is the real number and 2i is the imaginary number. i –> is the imaginary number that is imagined as the square root of -1 i.e., √-1. BelowContinue reading “Complex Number”

Data Types

Datatypes are common concepts across every language. The data that is stored in a variable determines the data types. For Example: a variable that stores a text has string as a data type, similarly, variable storing number has int, float or complex as data type depending on the complexity of the number. Let’s understand fewContinue reading “Data Types”

Comments in Python

Comments are statements that is written inside a code which is used mostly for adding the note about the code. Comments doesn’t gets executed. It is basically ignored by the compiler. Comments are added to increase the code readability and maintainability. There are specific syntax that needs to be followed to write comments. Single lineContinue reading “Comments in Python”

Design a site like this with WordPress.com
Get started