Saturday, May 31, 2014

Sum of Three Numbers in Python


As a beginner in Python programming it is not easy to write complex or sophisticated programs without learning how to write simple programs. Learning new programming language just like Python is just like learning a foreign language we must able to understand the word and its meaning. The syntax and the commands are very important to know how to use it properly. The way how the program works will follow as soon as the programmer understand how to use the language and the integrated programming environment just like here in Python.

Well about this program that I wrote in Python I called this program Addition of Three Numbers. This program is very simple in terms of its operation it will ask the user to give three numbers that is in integer in value and then display the total sum of the three numbers on the screen. One of the interesting features of Python that I have learned in writing this program is that I am using a function called input() to accept values from the user, however this function does not convert the number given by the user automatically in integer format. I have to use another function  called int() which converts the number given by the user from string value into integer value.

Using assignment operator Value_1, Value_2 and Value_3 I was able to store the number values given by the user. In addition the Python programming language allows us to use variable directly in our program without declaring it. If we compared in C,C++,Java and C# this programming language requires us to declare all the variable first including its data types before we can use it in our program.

I hope you find my work useful in learning how to program in Python programming language. Little by little your experience in writing simple program just like this one will pave way in your learning how to create much complex programs in the near future in your programming projects.

Thank you very much.


Sample Output of Our Program



Screenshot of Our Python Text Editor




No comments:

Post a Comment