Computer Learning

All About Computer And Technology

  • Home
  • Python Programming
    • How To Find Maximum And Minimum Value On Python Programming Language
    • Creating Tuple, List, and Dictionary on Python Programming Language
    • Learning about Input value using Python easily
    • Creating Function on Python Programming Language
    • Read More >>
  • Komputer
    • Program Execution (Organization and Architecture Computer)
    • Microcontroller of Von Neumann vs Havard and CISC vs RISC
    • Definition and Function of Control Unit
  • Blog Tutorial
    • How to Make Table of Content with Sroll in Blogspot
    • How to make Claim or Get Verification Our Blogs to Alexa
  • Tips dan Trik
    • How To Solve Red Cross In Blackberry
    • How to Restore Deleted File in Smartphone Memory Using Recuva
    • Selengkanya >>
  • Contact Me
Home » Python Programming Language » How to Use If, For, and While on Python Programming Language

How to Use If, For, and While on Python Programming Language

Joni
Add Comment
Python Programming Language
Sunday, July 20, 2014


Welcome back to my page guys !   
I’m happy to meet you again my friends because you all are the next generation on this country. We have power, we have strength to make our country be better. So we need to have fire spirit to learn about science and technologies. Before we discuss about the material that I write above, do you have learned about my writing before with theme “Learning about Bases of Python Programming Language for Newbie” ? I hope you have done that because it is important to understand before learning this. I just suggest to you, I think learning about Programming Language is almost same when we learn about calculation lecture like mathematics, physical, chemistry and so on. I mean that the equality of both needs our logic to solve problems. We need to exercise more and more. OK, let’s start our learning !

  1. First, I will tell you about if function (making decision)
    It is making decision or conclusion on one or more conditions. I will give you some examples below :

    If you don’t understand the meaning of the program above, you can visit my page with title “How to Write Mathematics Formula on Python Programming Language” Interactive Mode (result) of the program above after executed is the picture below :

    Actually, the program above also can be written by using if and else because there are two conditions. But if there are more than two conditions, we have to see the formulas below :

    if condition(1) :
        instructions
    elif condition(2) :
        instructions
    elif condition(3) :
        instruction
    elif condition(n) :
        instruction
    else:
        instruction

    So, we can make conclusion that when there are more than two conditions, we should use if, elif, else. 
    Well, I will give you one example again to make easier. See the picture below :

    Interactive Mode of the program above after executed is the picture below :

  2. We will continue to the next material, it is about for function (looping).
    for function will be useful on looping programs. For making easier to understand, just look the example below :

    Interactive Mode of the program above after executed is the picture below :

    Explanation :
    On program above, the variable of element has value number 1 until 100 with interval 1, so it will print number 1 until 100. And then the function of if, elif, else are for indexing number that can be divided by 50 or 30 or 10. The sequences of the program influences priority. What is the meaning ? For example, we take number 100. As the conditions, number 100 can be divided by 50 and 10. But according the program above, the first written of the conditions is 50. So, 50 is more prioritied than 10. OK, if you are rather confuse about that, I will give you one example more. See the picture below :

    Interactive Mode of the program above after executed is the picture below :

    Explanation :
    The example above writing sentences “welcome back friends”. The program uses for function where the program checks the letter one by one of the sentences and represented by variable letter. And then the if function will checks whether the letter exist in variable vowel or not. If there is, it will be printed and otherwise.
  3. We continue to the last topics in this writing is about while function.
    This function called iteration but also called looping as like as for function. But the difference is while function will run continually as long as the conditions is right. For clearing this topics, let’s see this example :

    Interactive Mode of the program above after executed is the picture below :

    Explanation :
    The program above show that the condition of while function is while != key. It means that the program will always run the construction in the below of while (if function) as long as the number which inputted is not same with the key. And the program will stop when the user input number 28 (the key).

  4. OK, I think it’s enough for today. I hope you can understand all of this material. You will understand easier when you love Python Programming Language. So, you need to love it first.I will try to give you deeper material about Python Programming Language. Thanks a lot for your visiting in my blog, and I hope it’s useful for me and you all my fiends. :)
Tweet
How to Use If, For, and While on Python Programming Language Title : How to Use If, For, and While on Python Programming Language
Description : Welcome back to my page guys !    I’m happy to meet you again my friends because you all are the next generation on this country. We ...
Rating : 5

0 Response to "How to Use If, For, and While on Python Programming Language"

Post a Comment

← Newer Post Older Post → Home
Subscribe to: Post Comments (Atom)

Popular Post

  • Program Execution (Organization and Architecture Computer)
    How to read this figure below ?  Notes  : Program Counter (PC) = Address of Instruction  Instruction Register (IR) = Ins...
  • How to Write Matematics Formulas on Python Programming Language
    Good night all programmers?  As my writing before about Learning if, for, and while function on Python Programming Language, I wil...
  • Microcontroller of Von Neumann vs Havard and CISC vs RISC
    Microcontroller of Von Neumann vs Havard and CISC vs RISC | pemprograman | komputer | bahasa python Microcontroll...
  • How to Use If, For, and While on Python Programming Language
    Welcome back to my page guys !    I’m happy to meet you again my friends because you all are the next generation on this country. We ...
  • How To Find Maximum And Minimum Value On Python Programming Language
    On my writing before, you have learned about tuple, list, and dictionary. You have to truly understand the topics before continuing to nex...
  • Contact Me On
    Contact Me on : e-mail : joni67676@gmail.com Facebook : John Twitter : @simplechilds Google + : Jhon Gu...
  • Creating Tuple, List, and Dictionary on Python Programming Language
    We have learned about Creating Function on Python Programming Language on my writing before. Now, we have to know how to collect a sequenc...
  • Definition and Function of Control Unit
    Definition and Function of Control Unit | pemprograman | komputer | bahasa python Control unit control CPU opera...

Label Cloud

  • Blog Tutorial
  • Komputer
  • Python Programming Language
  • Tips Trick

Blog

  • ▼  2014 (15)
    • November 2014 (1)
    • October 2014 (1)
    • September 2014 (3)
    • August 2014 (3)
    • July 2014 (7)

Followers

Mengenai Saya

Joni
View my complete profile
Back to top!
Copyright 2013 Computer Learning - All Rights Reserved Design by Mas Sugeng - Powered by Blogger