Я получил этот код, и я не думаю, что я действительно понимаю, как по модулю возвращает остаток, не хорошо в математике ..Пайтона недоразумение
Вот код:
#import the datetime class
import datetime
#declare and initialize variables
strDeadline = ""
totalNbrDays = 0
nbrWeeks = 0
nbrDays = 0
#Get Today's date
currentDate = datetime.date.today()
#Ask the user for the date of their deadline
strDeadline = input("Please enter the date of your deadline (mm/dd/yyyy): ")
deadline = datetime.datetime.strptime(strDeadline,"%m/%d/%Y").date()
#Calculate number of days between the two dates
totalNbrDays = deadline - currentDate
#For extra credit calculate results in weeks & days
nbrWeeks = totalNbrDays.days/7
#The modulo will return the remainder of the division
#which will tell us how many days are left
nbrDays = totalNbrDays.days%7
#display the result to the user
print("You have %d weeks" %nbrWeeks + " and %d days " %nbrDays + "until your deadline.")
Каков ваш вопрос, каков ожидаемый результат вашего кода и каков фактический результат? – Psytho