Home > other >  Python sprout new
Python sprout new

Time:10-10

Excuse me I this how to is wrong, for the perfect number, this is why the output like

CodePudding user response:

Do you want to do???????????

CodePudding user response:

Didn't understand you set this variable j has what effect

CodePudding user response:

Habit to 0, the first thought, and, when the print + 1 is better than in the range from 1 began, I also grows a new, personal experience, not necessarily right

CodePudding user response:

Your code changes like this:
N=int (input (' please enter=))
For I in range (1, n + 1) :
A=0
For j in range (1, I) :
If I==0 n % :
A=a + I
Print (" monitoring a value "+ STR) (a)
If n==a:
Print (" ultimate n value "+ STR (n))


Find out the problem by themselves.

CodePudding user response:

Running out, a value is 20, the output, no problem

CodePudding user response:

reference 4 floor weixin_44912281 response:
modify your code like this:
N=int (input (' please enter=))
For I in range (1, n + 1) :
A=0
For j in range (1, I) :
If I==0 n % :
A=a + I
Print (" monitoring a value "+ STR) (a)
If n==a:
Print (" ultimate n value "+ STR (n))


Find out the problem by themselves.

Thank you boss, thank you very much
  • Related