Home > other >  Python topic
Python topic

Time:10-29

Python
Question: today is how many days this year
Output: today is what day this year, this year has been the past xx %, XXX days left

CodePudding user response:

 the from datetime import datetime 
Now=datetime. Now ()

Print (" today is the first this year {} days, this year has been the past {: 2 f} %, only "{} days. The format ((now - a datetime (now. Year, 1, 1)). The days + 1,
100 * ((now - a datetime (now. Year, 1, 1)). The days + 1)/(datetime (now. The year + 1,1,1) - a datetime (now. Year, 1, 1)). The days,
(datetime (now. The year + 1,1,1) - now). The days))
  • Related