Posts

FUNCTIONS IN PYTHON

                                                 Functions in Python Functions are an essential part of the Python programming language you might have already encountered and used some of the many fantastic functions that are built-in in the Python language or that come with its library ecosystem. However, as a Data Scientist, you’ll constantly need to write your own functions to solve problems that your data poses to you.  You use functions in programming to bundle a set of instructions that you want to use repeatedly or that, because of their complexity, are better self-contained in a sub-program and called when needed.  That means that a function is a piece of code written to carry out a specified task. To carry out that specific task, the function might or might not need multiple inputs. When the task is carried out, the function can or can not return one or more values. Types of functions in Python:                               *Built-in Functions                               *U

Loops in python

                                                  Loops  in python                     One of the main components of the control flow in any language is loops. Like any other language, Python provides two main looping techniques which are  While Loop:- For Loop:- Uses of Loops * Using loops provide a shortcut to minimize code. * Increase the readability of code. * Reduce complexity. * In loops, a group of instructions tends to repeat itself till the termination condition. * The loops provide the opportunity of bringing similar executable instructions together, This technique makes the code reusable for similar tasks. Advantages of Loops in Python 1. Loops play a vital role in the simplification of complex problems. 2. Loops save the developers from manually writing and executing even the most straightforward and shortest instructions repeatedly. 3. Loops help increase the reusability of code. 4. These provide easy traversal for the elements like arrays and linked lists. *While Loop Wit
Image
                                                    Conditional Statements A conditional statement is a statement that runs a command block only when certain conditions are met. conditional statements are used to control or decide the flow depending on condition. There are four types of conditional statements 1) If Statement 2) If Else Statement 3) Elif  Statement 4)Nested If Statement 1) If Statement :- If statement is a simplest conditional statement. It is used when you need to print out the result when one of the condition is True or False. Syntax -: if(condition):       indented Statement Block Example -: X=input("Enter your name-:") if (X=="RAJ"):     print (f" HELLO {X}") Output-: Enter your name-:RAJ  HELLO RAJ Flowchart -: 2) If Else Statement -: In If-Else statement, If statement checks the given condition is True or Not and if the given condition is True it will directly executes the indented block of code. In Else statement it will executes the