Home > other >  Super small white consult an origami highly process problems
Super small white consult an origami highly process problems

Time:09-21

Good big! I am a beginner of python super white, in a small case: by origami fold the height of the paper to the height of mount Everest to practice while statement (program), there is a place not understand: participation in the program of the variable is not p and m, the number of origami count has never been involved in, isn't it, how finally calculate the number of origami count? Hope everybody the teacher for help to reassure, thank humbly!!!!!!



# a piece of paper folded in half, how many times to reach the height of mount Everest
P=0.08
M=8844000

Count=0 # records can be folded in half the number
While pP=p * 2
The count=count + 1
Print (" times: "the count," height: ", p)

Print (" folded in half the number: ", count, "height:", p)

CodePudding user response:

Each loop
The count=count + 1


Is not the count accumulation? How to say the count has never been involved in?

CodePudding user response:

reference 1/f, old coconut response:

each cycleThe count=count + 1


Is not the count accumulation? How to say the count has never been involved in?

The teacher is good! While not only the conditions of p and m? Not involved in the count, the count is not written in the book of this statement?

CodePudding user response:

Your post code, can't see level

But logically, should count=count + 1 in the while loop body, or after the operation, the count only equal to 2


I think it should be normal writing

 

# a piece of paper folded in half, how many times to reach the height of mount Everest
P=0.08
M=8844000

Count=0 # records can be folded in half the number
While pP=p * 2
The count=count + 1
Print (" times: "the count," height: ", p)

Print (" folded in half the number: ", count, "height:", p)


CodePudding user response:

While pP=p * 2
The count=count + 1

This is a loop body, as long as it is less than M, have been circulating, P * 2, count + 1
  • Related