Knowee
Questions
Features
Study Tools

What will be the output of the code shown below if the system date is 18th June, 2017?tday=datetime.date.today()bday=datetime.date(2017,9,18)till_bday=bday-tdayprint(till_bday)

Question

What will be the output of the code shown below if the system date is 18th June, 2017?tday=datetime.date.today()bday=datetime.date(2017,9,18)till_bday=bday-tdayprint(till_bday)

🧐 Not the exact question you are looking for?Go ask a question

Solution

The code you've provided is written in Python and it's used to calculate the number of days between the current date and a specified date. However, there seems to be a formatting issue with your code. Here's the corrected version:

import datetime

tday = datetime.date.today()
bday = datetime.date(2017, 9, 18)
till_bday = bday - tday

print(till_bday)

If the system date is 18th June, 2017, the output of the code will be the difference between 18th September, 2017 and 18th June, 2017.

The output will be: 92 days, 0:00:00

This means there are 92 days between 18th June, 2017 and 18th September, 2017.

This problem has been solved

Similar Questions

What is the output of the code shown below if the system date is: 6/19/2017?tday=datetime.date.today()tdelta=datetime.timedelta(days=10)print(tday+tdelta)

1234567from datetime import datep = input("dob in ddmmyyyy format: ")l = input("today's date in ddmmyyyy format: ")g = date(int(p[4:]), int(p[2:4]), int(p[:2]))t = date(int(l[4:]), int(l[2:4]), int(l[:2]))dsb = (t-g).daysprint("days since birthday:",dsb)Close

What will be the output when the following code is executed?public class Product {public static void main(String[] args) {                             LocalDate startLocalDate = LocalDate.of(2016, Month.JUNE, 01);LocalDate tempLocalDate = startLocalDate;startLocalDate.plusDays(10);System.out.println(tempLocalDate);}} 2016-06-0101-06-20162016-06-1111-06-2016

Test time left: 47:16 Choose the Correct Answer(s) What does the following statements do? from datetime import * print(datetime.today().strftime('%B')) Options Displays the full weekday name Displays the full month name Displays the abbreviated day name Displays the abbreviated month name

Write a JAVA program in which take date(DDMMYYYY) from user and displaynext day date(DDMMYYYY) as output.Example:Input: date=09, month=-06, year=1992Output: date=10, month=-06, year=1992Note:-1. Consider condition for leap year2. Consider number of days in month of February based on leap year ( if leapyear then February days =29, else days = 28 ) )3. Consider number of days either 30 or 31 based on month entered by user

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.