Fourth Test report The test four-cycle structure of the program design

Experiment 4 programming cycle structure

 

Class: Logistics 191 Name: relaxation student number: 3190505120

Date: 2020 April 9 Instructor: Yu Xiu

 

Experiment 4 programming cycle structure

 【Purpose】  

(1) be familiar with methods while and for statements implement loop

(2) control method used in a programming cycle implement algorithms;

[Experiment Conditions]  

PC or remote programming environment

[Experimental] content

 (1) Calculate the value of base e

 

description:

 e is sometimes called natural constant (Natural constant), is approximately equal to the 2.71828182845904523536 ...... irrational number.

Use the following formula to find the number of base e of natural logarithm approximation.

              e = 1 + 1/1! +1/2! ... + 1 / n! 

    Cycle program can be designed, an absolute value is determined until the last stop of less than 10 -6 power cycle, as noted calculation error reason, different methods may differ slightly.

(2) determining the number of daffodils

description:

     Narcissistic number (Narcissistic number) is also known as super does not fully digital variable, the number of narcissism, since a power of Armstrong Armstrong number or number (Armstrong number), the number refers to a three-digit daffodils, it's on each digital bit 3 is equal to the sum of power itself (eg: 5 + 1 ^ 3 ^ 3 ^ 3 + 3 = 153).

   Design cycle program, enter a three-digit integer, determine whether the number of daffodils, narcissus if the number is, the output "is the number of Narcissus", otherwise output "not the number of Narcissus"

 

(3) N multiple party 

description:

   Write a program to calculate the input power of 0 to 5 the number N of power results, and sequentially outputs the results of the 6, between the output separated by spaces. Where: N is a floating point number.

    print () function may output a plurality of information simultaneously, by the following method may be used for a plurality of spaces divided output:

print(3.14, 1024, 2048)

 

[Experimental recording and analysis]

 (1) Calculate the value of base e

 

 

(2) determining the number of daffodils

 

 

 

 (3) N multiple party 

 

 

 

 

[Questions]

      What is the number of cycles in the loop structure is dependent?

            () Within the structure of the contents of the brackets for i in range

            while the structure, depending on the constraints while immediately

Class: Logistics 191 Name: relaxation student number: 3190505120

Date: 2020 April 9 Instructor: Yu Xiu

 

Experiment 4 programming cycle structure

 【Purpose】  

(1) be familiar with methods while and for statements implement loop

(2) control method used in a programming cycle implement algorithms;

[Experiment Conditions]  

PC or remote programming environment

[Experimental] content

 (1) Calculate the value of base e

 

description:

 e is sometimes called natural constant (Natural constant), is approximately equal to the 2.71828182845904523536 ...... irrational number.

Use the following formula to find the number of base e of natural logarithm approximation.

              e = 1 + 1/1! +1/2! ... + 1 / n! 

    Cycle program can be designed, an absolute value is determined until the last stop of less than 10 -6 power cycle, as noted calculation error reason, different methods may differ slightly.

(2) determining the number of daffodils

description:

     Narcissistic number (Narcissistic number) is also known as super does not fully digital variable, the number of narcissism, since a power of Armstrong Armstrong number or number (Armstrong number), the number refers to a three-digit daffodils, it's on each digital bit 3 is equal to the sum of power itself (eg: 5 + 1 ^ 3 ^ 3 ^ 3 + 3 = 153).

   Design cycle program, enter a three-digit integer, determine whether the number of daffodils, narcissus if the number is, the output "is the number of Narcissus", otherwise output "not the number of Narcissus"

 

(3) N multiple party 

description:

   Write a program to calculate the input power of 0 to 5 the number N of power results, and sequentially outputs the results of the 6, between the output separated by spaces. Where: N is a floating point number.

    print () function may output a plurality of information simultaneously, by the following method may be used for a plurality of spaces divided output:

print(3.14, 1024, 2048)

 

[Experimental recording and analysis]

 (1) Calculate the value of base e

 

 

(2) determining the number of daffodils

 

 

 

 (3) N multiple party 

 

 

 

 

[Questions]

      What is the number of cycles in the loop structure is dependent?

            () Within the structure of the contents of the brackets for i in range

            while the structure, depending on the constraints while immediately

Guess you like

Origin www.cnblogs.com/zhangchi123/p/12664328.html