Ask Question

3.3 Code Practice: Question 1

(Phython coding btw)

Question:

Test if a date is a payday based on the day of the month (15th or the 30th).

Sample run:

Enter today's day numerically: 17

Sorry, not a payday.

Enter today's day numerically: 30

It's payday!

+3
Answers (1)
  1. 10 August, 05:56
    0
    Python Code:

    date = int (input ("Enter today's day numerically: "))

    if date = = 15:

    print ("it's Payday")

    elif date = = 30:

    print ("it's Payday")

    else:

    print ("Sorry, not a PayDay");

    Code Explanation:

    First get date integer value from input by using input () method in python.

    After that check is entered date equals to 15 or 30 then print it's Payday and at the end if user enter other then 15 and 30 the print Sorry, not a PayDay in else clause.

    Code Ouput

    Enter today's day numerically: 15

    it's Payday

    Enter today's day numerically: 17

    Sorry, not a PayDay
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “3.3 Code Practice: Question 1 (Phython coding btw) Question: Test if a date is a payday based on the day of the month (15th or the 30th). ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers