CBSE Class 11 Computer Science
Question 19 of 25
Python Fundamentals — Question 2
Back to all questions 2
Question Question 2
Write a program to read today's date (only del part) from user. Then display how many days are left in the current month.
Solution
day = int(input("Enter day part of today's date: "))
totalDays = int(input("Enter total number of days in this month: "))
daysLeft = totalDays - day
print(daysLeft, "days are left in current month")Output
Enter day part of today's date: 16
Enter total number of days in this month: 31
15 days are left in current month
day
=
int
(
input
(
"Enter day part of today's date: "
))
totalDays
=
int
(
input
(
"Enter total number of days in this month: "
))
daysLeft
=
totalDays
-
day
print
(
daysLeft
,
"days are left in current month"
)
Output
Enter day part of today's date: 16
Enter total number of days in this month: 31
15 days are left in current month