An-Hui Engineering University
Python programming test report
Class Logistics 192 names Zhang Yu student number 3190505221 scores
Date 2020. 4.8 instructor repair buildings
[Name] experiment experimental three-branch structure of the program design
【Purpose】
(1) learn how to correctly use comparison expressions and comparison, logical operators, and logical expressions;
(2) if statement of design choice by the skilled structure of the program
[Experiment Conditions]
PC or remote programming environment
[Experimental] content
1. Complete the three programming problems (python123)
(1) design a currency conversion program
Problem Description:
Examples of the preparation of a reference temperature conversion currency conversion process.
Assumed dollar / yuan exchange rate: 6.7744: 1
Input and output as follows
Value (2) solving mathematical expressions
Problem Description:
Value x entered from the keyboard, and outputs the value calculated according to the formula x and y.
Input and output as follows
(3) the new personal income tax calculation
Problem Description:
Write a program to calculate personal income tax based on user input.
1. User input is personal income payroll deduction insurance.
(1) Conventional user input in units of RMB zero or a positive number. Do not add extra message.
(2) If the user enters a negative number, the prompt "Please enter a positive number!." Other input error can not be processed.
2. Calculate taxes payable (a retained after the decimal point).
Our personal income tax using "excess progressive tax rate" calculation method, the simplified formula is as follows:
Tax = (salary deduction insurance personal income - tax exemption amount) * tax rate
Wherein the amount of a tax exempt 5,000, taxes payable according to the number of different, as shown below:
Input and output as follows
[Questions]
1, try to run your program with IDLE, if the user input does not match the input format, the program will run what appear
2. How do you think where to modify the program so that several people can interact with the computer more user-friendly?
[1] Currency Conversion: prompt input errors, enter the monetary value with the symbol; solving mathematical formula: input format error.
[2] Use try, except for the exception handling procedures