Home > other >  For bosses to help see where is wrong
For bosses to help see where is wrong

Time:10-13

, written in Python function peven (n), calculated function function: 1 + 1/3 + 1/5 + 1/7... + 1/2 n + 1 and the output,

Def peven (n) :
N=input (" please enter a number n:)
N=int (n)
Int I, a
I=2 n + 1
While I> 1.
A=1/I
The sum +=a
I=I - 2
The else
Print (sum)

CodePudding user response:

Variable sum is not defined, there is no initial value, on the other hand, don't suggest doing it in a built-in function name variable name,

CodePudding user response:

A small piece of code, the error of too many,
int I, a
This is not the c language, don't need to define variables


Please refer to!

CodePudding user response:

Suggested for, the simple with the, programming is for convenience
  • Related