An-Hui Engineering University
Python programming test report
Class Logistics 192 Name Cheng Cheng student number 3190505240 scores
Date 2020.3.22 instructor repair buildings
[Experiments] Experiment two sequential name Structured Programming (confirmatory test)
【Purpose】
(1) Method of control of input and output data;
(2) structure of the program execution in order familiar statements;
(3) Design of the sequence control structure of the program.
[Experiment Conditions]
PC or remote programming environment
[Experimental] content
1, completed three programming problems. (Python123)
(1) Calculation of the area of a circle calculated S
Problem Description:
The calculated area of a circle radius of the circle, radius 25. Please write and run the following code:
radius = 25 # 25 is the radius of a circle
area = 3.1415 * radius * radius # circular area is calculated according to the formula
print ( "{:. 2f}". format (area)) # outputs only two decimal places the result
input Output:
Input: None Output: 1963.44
(2) sum
Questions Question:
Programming, input from the keyboard two numbers x, y, find x, y and assigned to the sum of s, the final output s.
input Output:
(3) Determine the volume of a sphere
Problem Description:
Enter the radius of the sphere, the sphere volume calculation.
input Output:
Input: A positive number
Output: the volume of the ball, as a result two decimal places
[Experimental recording and analysis]
Experimental records and analysis results:
(1) Calculation of the area of a circle calculated S
(2) sum
(3) Determine the volume of a sphere
[Questions] (be careful not to leak A)
1, question 1 What influence factors and calculation accuracy of 3 questions? How to make a value of 1 and 3 to get a more accurate? (You can try on the local computer, or self-programmed on python123)
(1) π values: In the calculation we obtain a value of 3.1415 [pi], [pi] and is itself an infinite decimal, therefore there is an error.
(2) floating-point issues: the computer is in binary arithmetic, so there will be problems in terms of.