Curriculum
Data Input: input() function
In brief
The example above is inconvenient because the source data for the program is specified in the program text, and in order to use the program for another triangle, it is necessary to correct the program text. This is inconvenient; it is better that the program text does not change, and the program asks the user for the data necessary to solve the problem, that is, it asks for the values of two initial variables a and b. To do this, we will use the function input(), which reads a line from the keyboard and returns the value of the read line, which we will immediately assign to the variables a and b: