June 2023

  • WHAT IS A CLASS AND OBJECT IN PYTHON?

    DEFINITION OF PYTHON CLASS AND OBJECT Python Class The Class is a logical entity that has some attributes and methods, in other words, we can also say that the class is like an object constructor or a “blueprint” for creating objects. Python Objects The Object is an entity that has a state and behavior. HOW…

  • WHAT ARE LAMBDA FUNCTIONS IN PYTHON?

    Definition of Python Lambda Functions Lambda Functions are anonymous or unnamed short functions. Syntax of Lambda Functions in Python Examples of Python Lambda Functions Lambda function with single argument Code Output Lambda function with multiple arguments Lambda functions can take any number of arguments Code output

  • HOW TO USE FUNCTIONS IN PYTHON?

    WHAT IS A FUNCTION IN PYTHON? A function is a named sequence of statements or a block of code that only runs when it is called by its name. We can pass data, known as parameters, into a function. On calling a function it will execute the block of code and can return data as…

  • HOW TO USE FOR LOOPS IN PYTHON?

    A For loop is used to execute a set of statements, once for each item in a list, tuple, set, dictionary, string, or any iterable object, etc. As shown in below example it will print each fruit available in the list output The break Statement The break statement is used to stop the loop before…

  • HOW TO USE WHILE LOOP IN PYTHON?

    The while Loop While loop is used to execute a set of statements as long as the provided condition is true, as shown in below example that i will be printed as long as i is less than 5 output The break Statement The break statement is used to stop the loop even if the…

  • HOW TO USE IF ELSE IN THE PYTHON?

    Using the if keyword in the Python Syntax- if <Logical_Condition>: <if_block> When <Logical_Condition> returns True value then the code given in <if_block> will execute as shown in below example- Output Using the Elif keyword in the Python The Elif keyword is used to provide another Logical Condition in case the previously provided condition is not…

  • WHAT IS LIST IN PYTHON?

    LIST DEFINITION- A LIST is basically a data structure consisting of a collection of any datatype ordered, changeable, and indexed elements or items, created by enclosing elements in square brackets or by using List() constructor. List items allow duplicate values and its first item has index [0]. Properties of List items- Ordered– List items have…

  • WHAT ARE SETS IN PYTHON?

    SETS DEFINITION- A set is basically a data structure consisting of a collection of any datatype unordered, unique, unchangeable, and unindexed elements, created by enclosing elements in curly braces or a set constructor.Note-Set items are unchangeable, but you can remove and/or add items HOW TO CREATE A SET IN PYTHON? By using curly braces Python…

  • WHAT IS A DICTIONARY IN PYTHON?

    DICTIONARIES A dictionary is a mapping of keys to values. It’s also sometimes called a hash table or associative array. The keys serve as indices for accessing values. Dictionaries are written with curly brackets as shown in the below examples. Dictionaries in python are used to store data values in key: value pairs each pair…

  • HOW TO USE TUPLE IN PYTHON?

    TUPLE A Tuple is an ordered and unchangeable collection of python objects, each object is separated by a comma and the whole set is enclosed by parenthesis. Tuples allow duplicate values. PROPERTIES OF TUPLE Tuple items or objects are ordered, unchangeable, and allow duplicate values. Tuple items are indexed, the first item has an index [0], the…

  • WHAT IS THE STRING TYPE IN PYTHON?

    WHAT IS THE STRING TYPE IN PYTHON?

    STRINGS in python are arrays of bytes representing Unicode characters, in python syntax string is represented by enclosing characters in single or double quotes for one liner statement. And Multiline strings are represented by enclosing it in three double or three single quotes. Example Code a=’Hello World’print(a)b=”Hello World”print(b)c=”””This is multilinestring statement!”””print(c)d=”’This is multilinestring statement!”’print(d)print(a[0],a[1]) Output Hello…

  • WHAT ARE THE NUMERIC TYPES IN PYTHON?

    WHAT ARE THE NUMERIC TYPES IN PYTHON?

    NUMERIC DATA TYPES Python uses following three types of numeric data types. type() function in Python is used to get data type of object. Data Type Examples Output Description int x=1 print(type(x)) <class ‘int’> Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length. float x = 3.5 print(type(x)) <class…

  • WHAT ARE THE DATA TYPES IN PYTHON?

    WHAT ARE THE DATA TYPES IN PYTHON?

    Python has the following data types built-in by default. Variable can store data of different types as per requirements. Categories Data Type Example Text str x = “Be Happy” Numeric int x = 1 Numeric float x = 3.5 Numeric complex x = 1j Sequence list x = [“A”, “B”, “C”] Sequence tuple x =…

  • WHAT IS THE GLOBAL VARIABLE IN PYTHON?

    WHAT IS THE GLOBAL VARIABLE IN PYTHON?

    Global Variables in python are the Variables that are created outside of a function. Global variables can be used anywhere by everyone within the program. To create a global variable inside a function, you can use the “global” keyword and its scope will be global. Example- x=”globalVariable1″     #variable declaration y=”globalVariable2″     #variable declaration def…

  • WHAT IS THE VARIABLE IN PYTHON?

    WHAT IS THE VARIABLE IN PYTHON?

    Python variables are the reserved memory locations used to store values with in a Python Program. A variable in Python is created the moment you first assign a value to it. Variables in Python do not need to be declared with any particular type, and can even change type after they have been set. If…

  • HOW TO PRINT IN PYTHON?

    HOW TO PRINT IN PYTHON?

    •print function,which writes to standard out. Standard out is where the computer writes its output. •Strings or characters are enclosed in inverted commas. print(“hello world”) •Output of above statement. hello world •To print out multiple items, you can provide them separated by commas. You can put strings and numbers in a print function. print(“my”,”program no.”,1)…

  • WHAT IS THE PYTHON SYNTAX?

    WHAT IS THE PYTHON SYNTAX?

    Python syntax defines a set of rules that are used to create Python statements while writing a Python Program. Case sensitivity in Python-  Case sensitivity in Python is applicable as python is a case sensitive programming language. Indentation in Python- Indentation in Python is used to indicate a block of code, all statements within the…

  • HOW TO INSTALL PYTHON AND EXECUTE PROGRAM?

    HOW TO INSTALL PYTHON AND EXECUTE PROGRAM?

    To check if you have python installed on a Windows PC, run the following command on the Command Line (cmd.exe)- python –version   If you find that you do not have Python installed on your computer,   then you can download it from website: https://www.python.org/ To execute the program first save the code in the text editor…

  • WHAT IS PYTHON?

    WHAT IS PYTHON?

    Python is an interpreted programming language released in 1991. Python was created by Guido van Rossum, Dutch Programmer. Python is a high-level, interpreted, interactive, and object-oriented scripting language. Python source code is also available under the GNU General Public License (GPL). Python supports multiple programming paradigms, including Procedural, Object Oriented and Functional programming language. Python…

  • PYTHON FREE COURSE

    PYTHON FREE COURSE

    Learn Python