Informationis the basis of all programs. The problem appears how to implementthat information to the program in order to receive quality anduseful one. However, even the simplest program operates with somedata. Despite the fact that the information can be sent via thefiles, very often we need to receive data from the customersdirectly. In this paper I will show some examples of operating thedata.
Asan example seetheimage belowwhere the programreceives the user`sinformation entered via the keyboard.
Howusingthe built-in functiona program canget the right data?Forthispurpose functioninput()exists.Itis enough to set toa variable the result of the function and consider the variablereceives information that a user enters. Also,very useful is the ability to notify the user that the programexpects him some action because he can not guess about it. Thepicture shows the program asks the user about his name(Kindy, M. 2008).
Itis not necessary sent a message to the user via simple text inargument field of input()function, we can use a variable. Here is the example when the messageis sent witha variable, certainly parameter input ().
Kindy,M. (2008) in the chapter 5 also described 2 functions (functionis int () and float ().)which are not related to transmitting data from the user to program,however they are still very important. Thefunction int () converts numerical numbers in general, while thefloat() makes them floating point
Hereis the consequenceof thesituation whentheinput functions int () and float () arenot transmitted to the input number buttext.
Theexample below shows the easy way of displaying a vast amount of datawhich is strictly structured and, moreover, in mixed form.Also, the output formattingcan bedonewith such characters as n, t etc
Withbuilt-in features,already discussed,itwasdemonstrated someothers functions,such as: max (), min (), type (). In the example below, the functionabs () displays the absolute value of the argument.
Kindy,M. (2008), in ch15proposed very interesting and useful functionality such asadvertisement andcreatingyour own functions.With this knowledge, it is easy to create great programs which willconsist of theirownfunctions. Also, variablesand parameters are local, that they can not cause or use outside thefunction.
Theexampleof ownfunction isabove.The function atenterencereceives one argument,however,in the body offunctionthereare twoparameters which mean that there are two steps on this argument.
Allthe materials are surprisingly useful, for without knowledge of thisfunctionality is hard to imagine further studingof programming in Python. Without input output data,applications can not work with the user,andthe program becomes useless as the programs are created for theusers.
Built-infunctions give our programs a lot of features and makeeasierto work because we do not need to invent andwritebyourself.Asto ownfunctions, without their presence programmingcannot be donein global terms, as people learn to program not only inorder touse the built-in functions, but primarily to create their ownsolutions.
Kindy,M. (2008). Chapters 5: Keyboard input. Python 2: For Beginners Only.Edition1.0. Retrieved from http://cs118.kindy.net/p2fbo_20131230.pdf
Kindy,M. (2008). Chapters 6: Formatted output. Python 2: For BeginnersOnly. Edition1.0. Retrievedfrom http://cs118.kindy.net/p2fbo_20131230.pdf
Kindy,M. (2008). Chapters 7: Built in functions. Python 2: For BeginnersOnly. Edition1.0. Retrievedfrom http://cs118.kindy.net/p2fbo_20131230.pdf
Kindy,M. (2008).Chapters15: Programmer-defined functions. Python 2: For Beginners Only.Edition1.0. Retrievedfrom http://cs118.kindy.net/p2fbo_20131230.pdf