Posts

Showing posts from 2017

Recursion and lambda function in python

Image
Recursion and lambda function in python Hello Friends, I am Nirav. And in this tutorial I going to show you Recursion and lambda function in Python.. So, Let's get Started Recursive           We know that a function can call other functions. it is even possible for the function to call it self. These type of construct are termed as recursive function. EX:- Example for Factorial value using recursive Advantage of recursive           1.)It's make code clean and elegant           2.)Sequence generation is easier Disadvantage of recursive           1.)logic behind recursion is hard to follow           2.)It's hard to debug Lambda           Lambda is a function which define without name           In python normal functions are define using def keyword but lambda function are define using lambda keyword. Syntax:-  lambda argument = expression Ex:- Example of lambda function for double value Use of lambda fun

Function in python

Image
Function in python Hello Friends, I am Nirav. And in this tutorial I going to show you Function in Python .. So, Let's get Started What is function ?            A function  is a block of organized, reusable code that is used to perform a single, related action. Function  provide better modularity for your application and a high degree of code reusing. As you already know,Pyhton  gives you many built-in function  like print(), etc. but you can also create your own function. What is user define function ?            It's provide to create your own function in python. Why we use function ?           Once a function is defined it can be used over and over again. you can invoke the same function many time in your program which save your work. How to create function ?           In python if you want to create a function first start with def  keyword Function with one parameter           When you want to pass one parameter on function

Dictionary and Tuples in Python

Image
Dictionary and Tuples in Python Hello Friends, I am Nirav. And in this tutorial I going to show you Dictionary and Tuples in Python .. So, Let's get Started Dictionary What is Dictionary ?            A dictionary  is an associative array (also known as hashes). Any key of the  dictionary  is associated (or mapped) to a value. The values of a  dictionary  can be any Python  data type. So  dictionary  are unordered key-value-pairs. Why we use Dictionary ?           To, give key value to any instruction or value.. How to create a Dictionary ?            Creating a dictionary is as simple as placing items inside curly braces {} separated by comma. An item has a key and the corresponding value expressed as a pair, key: value. While values can be of any data type and can repeat, keys must be of immutable type ( string ,  number   or  tuple  with immutable elements) and must be unique. How to access element from Dictionary        While index

Loop Control Statement

Image
Loop Control Statement Hello Friends, I am Nirav. And in this tutorial I going to show you Loop Control Statement  in Python.. So, Let's get Started What is Loop ?           Loop is a sequence of instruction that is continually repeated until a certain condition is reached.           Ex:- For example one teacher punish boy that  write something until she don't tell him to stop.  That is one loop that boy can't stop until teacher can't tell him to stop Why we use loop statement ?           To execute one think many times. Ex:- if you want to print "hello" ten times than you have to use loop Types of loop  There are mainly 2 types of loop           1.) Entry Control            2.) Exit Control 1.) Entry Control            An entry control loop check the condition first and then after enter the loop body.           Ex:-  For Loop , While Loop 2.) Exit Control            An Exit Control loop execute body first

User Input

Image
User Input Hello Friends, I am Nirav. And in this tutorial I going to show you User Input  in Python.. So, Let's get Started Why we wants user input ?           If you wants to develop some think for user that user can give his/her personal details and based on that your program will be work so that time we have to use user input. For EX:-      If you want to make a calculator than you have to get input from user side to enter numbers and after that enter arithmetic operation to perform. Arithmetic operations :- * , / , - , + , %           So, as you shown in upper it's store name in String datatype .  When you enter a value at that time if you don't put value in double invoted coma than it's treat that value as a integer and if you put that value in double invoted coma than it's treat as a String datatype.  Input more than one at a time           In python if you want to input more than one value at a time That's poss

Boolean Expression and If..else Condition

Image
Boolean Expression and If..else Condition Hello Friends, I am Nirav. And in this tutorial I going to show you Boolean Expression and If..else Condition in Python.. So, Let's get Started What is Boolean Expression ?          it's a expression that result in a Boolean value that is, in a value of wither true or false. If Condition Decision making is required when we want to execute a code only if a certain condition is satisfied. The if..elif..else  statement is used in Python for decision making. Here, the program evaluates the test expression  and will execute statement(s) only if the text expression is True . If the text expression is False , the statement(s) is not executed. In Python, the body of the if statement is indicated by the indentation. Body starts with an indentation and the first unindented line marks the end. Python interprets non-zero values as True. None and 0 are interpreted as False Example Of if..else . I