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 !
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 :
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 :
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.
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).
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. :)