Computer Science
Write a program to read today's date (only del part) from user. Then display how many days are left in the current month.
Answer
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
Related Questions
Correct the following program so that it displays 33 when 30 is input.
val = input("Enter a value") nval = val + 30 print(nval)
Write a program that displays a joke. But display the punchline only when the user presses enter key.
(Hint. You may use input( ))Write a program that generates the following output :
5
10
9
Assign value 5 to a variable using assignment operator (=) Multiply it with 2 to generate 10 and subtract 1 to generate 9.Modify above program so as to print output as 5@10@9.