Python design experiments reporting procedures (three) - the branch structure of the program design

Python design experiments reporting procedures (three) - the branch structure of the program design (design of experiments)

An-Hui Engineering University

  Python design experiments reporting procedures (b)

 

                                                                           Class:   Logistics 192   Name: Liu Jiao Yang school number 3190505213  grades:            

Date  : 2020.3.21      Instructor: Xiu Yu  

【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, completed three programming problems.

(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 formats

Example 1: Enter a US dollar currency value: $ 32.3 when the input dollar return to the "dollar conversion after the yuan is: ¥ 32 yuan "

Example 2: Enter a value of RMB Currency: ¥ 10.1, when the input yuan return "RMB converted into US $ is: $ 32 US dollars."

 

Value (2) solving mathematical expressions

Problem Description

Keyboard input from the value of x, and the output value is calculated according to the formula x and y

Direct output value of y, to two decimal places, no additional information

(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:

 

It should be noted in English punctuation, the first entry is the wrong result output error as a symbol

[Experimental recording and analysis]

(Please fill in the experimental records and analysis results)

Above

 

[Questions]

Try IDLE to run your program, if the user input does not match the input format, the program will run what appear?

How do you think where to modify several aspects of the program allows a computer to interact with people more friendly?

One,

two,

three,

How do you think where to modify several aspects of the program allows a computer to interact with people more friendly?

You can try and except

Guess you like

Origin www.cnblogs.com/mmool/p/12634985.html