+ 3
How come my code doesn't work?
#number of pages read pages = int(input()) #rate of number of pages read per week rate = 20 #number of pages in a book book = 904 #number of weeks weeks if pages<book: #finding how many weeks wiil it take to me finish weeks = (book -pages)/rate while weeks>8: #increases the rate rate =+1 break print(weeks) print(rate)
2 Respostas
+ 4
In addition to what @Ariela stated,
rate += 1
not
rate =+1
which will just set the value of rate to 1 as 1 and +1 mean the same thing.
Then you may also want to remove the break statement as the while loop will only run 1 time and exit as it is.
+ 3
Assign weeks = 0