Skip to main content

Learn Python Programming Easily

   

Hello Friends๐Ÿ’–



In Our Previous Blog, We have Learned the Basics of Python Programming Language & Simple Program in Python Programming Language.

Now In this Blog, We will learn about Looping Statement and its Programs in Python.



What is Looping Statement in Python Programming Language.


Looping Statement :- A loop in a programming language is a statement that contains instructions that are repeated over and over again until a certain condition is reached.

  When a task has to be repeated again and again then loop helps us to remove the REDUNDANCY of the code.

Suppose you want to print your name five times, instead of writing the statement five times, you can use a loop.


Types of Loops in Python Programming Language

There are mainly two types of loops in the Python programming language.

  • While Loop
  • For Loop


    While Loop :- In the while loop, first the condition is checked, then the statement is executed and it continues to execute until the condition becomes false.


    Syntax of While Loop

    while expression:

        statement(s)


    Example of While Loop - Program

    i = 1

    while i >= 5:

        print("Number = ",i)

        i += 1

    ======================

    Output

    Number = 1

    Number = 2

    Number = 3

    Number = 4

    Number = 5


          For Loop :- The syntax of loops in Python is quite different from the rest of the programming language. Loop is used to iterate over a sequence (such as Lists, Tuples, Dictionaries & Sets, etc.).


          Syntax of For Loop

          for <Variable - Name> in <Sequence - Name>
                  statements


          Example of For Loop - Program

          x=[11,22,33,44]

          for i in x:

              print("List Element/Value = ",i)

          =======================

          Output

            List Element/Value =  11

            List Element/Value =  22

            List Element/Value =  33

            List Element/Value =  44


            If You want to Know the Basics of Python Programming Language then Click On this Link.


            If You want to Know about Information Technology or It Technology, Then Click on the Link given above.

            If you want to see our privacy policy then you can click on this link.



            Hope, You Enjoy this Our Blogs on Python Language.๐Ÿ˜Š



            Comments

            Post a Comment

            Popular posts from this blog

            Read about Python Programming Language.

                   Hello Friends. In Our Previous Blog ,   We have Learned the Basics of Python Programming Language & Simple Program in  Python Programming Language. In Today's Blog We Will Create Some Basic Program in Python Programming Language. Print List Item in Assending Order Without Using Sort Function Program in Python Programming Language. Assending Order- Program #List in Assending Order list=[9,5,1,7,5,3,6,2,8,0] for i in range(0,len(list)):     for j in range(i+1,len(list)):         if list[i]>list[j]:             temp=list[i]             list[i]=list[j]             list[j]=temp print(type(list)) print("Assending Order = ",list)      Outpu t <class 'list'> Assending Order =  [0, 1, 2, 3, 5, 5, 6, 7, 8, 9] Print List Item in Dessending Order Without Using Sort Function Program in Python Programming Language...

            Learn Different Methods In Python Programming Language

                   Hello Friends. In Our Previous Blog ,   We have Learned the Basics of Python Programming Language & Different Program in  Python Programming Language. In Today's Blog We Will Create Some Basic Methods In Python Programming Language. Create Some Different Methods in  Python Programming Language. Program #Create Different Methods In Python Programming Language. def swap(a,b):     a=a+b     b=a-b     a=a-b     print("First Value = ",a)     print("Second Value = ",b) def arth():     c=a+b     print("Addition = \t",c)     c=a-b     print("Substraction = \t",c)     c=a*b     print("Multiplication = ",c)     c=a//b     print("Division = \t",c)     c=a%b     print("Reminder = \t",c) def comp():     if a>b:         print("First Value is Greater = \t",a)     eli...

            Acquire a Knowledge of Python Programming Language

            Hello Friends๐Ÿ’ In Our Previous Blog ,   We have Learned the Basics of Python Programming Language & Simple Program in Python Programming Language. Now In this Blog, Today we will create a Basic Project in Python Programming Language. With the Help of the Program, We will be able to Easily see the Length and Width of a House and the Number of tiles to be Installed in that House and the Cost to be Installed as well as the Cost of Wiring in the House. Basic Project in Python Programming Language. Basic Project Program l=int(input("Enter Your House Length=\t")) a=l*b print("Area of House=",a,"sq. =\t") print("Select       Tiles        Price(per/sq)") print("A    -   Black-Marbel    150/sq") print("B    -   Kota Stone        100/sq") print("C    -   Granite              200/sq") print("D    -   White...