Question 1You are creating an application that prompts the user to enter the day of the month on which they want a transaction to occur. You are concerned that a malicious use may enter something that is not a number that is valid for the month selected. You plan to start by testing to see if the user typed in a number. Later, you will test the number to see if it’s valid for that month. What code should you add to your program?1 pointif date.isdigit() is True: code asking the user to enter a valid numberif date.isdigit is False: code asking the user to enter a valid numberif date.isdigit is True: code asking the user to enter a valid numberif date.isdigit() is False: code asking the user to enter a valid number
Question
Question 1You are creating an application that prompts the user to enter the day of the month on which they want a transaction to occur. You are concerned that a malicious use may enter something that is not a number that is valid for the month selected. You plan to start by testing to see if the user typed in a number. Later, you will test the number to see if it’s valid for that month. What code should you add to your program?1 pointif date.isdigit() is True: code asking the user to enter a valid numberif date.isdigit is False: code asking the user to enter a valid numberif date.isdigit is True: code asking the user to enter a valid numberif date.isdigit() is False: code asking the user to enter a valid number
Solution
The correct code to add to your program would be:
if date.isdigit() is False: code asking the user to enter a valid number
This code checks if the input 'date' is not a digit. If it's not a digit (i.e., if it's a letter or a special character), it will prompt the user to enter a valid number.
Similar Questions
Define a function named is_valid_day() which takes no parameters. The function prompts the user to enter a date and validates the day value only. The function returns True if the day value is within the specific range based on the particular month, and returns False otherwise. The months and their corresponding number of days are listed below:January, March, May, July, August, October, December: 31 days.February: 29 days (we consider a leap year for all cases).April, June, September, November: 30 days.For example:Test Input Resultprint(is_valid_day())2002-02-30Enter your birth date (yyyy-mm-dd): 2002-02-30Falseprint(is_valid_day())2003-04-31Enter your birth date (yyyy-mm-dd): 2003-04-31Falseprint(is_valid_day())2005-07-31Enter your birth date (yyyy-mm-dd): 2005-07-31True
Write a C program that prompts the user to enter the date as three integer values for the month, the day in the month, and the year. The program should then output the date in the form 31st December 2010 when the user enters 12 31 2010, say. The program has to work out when superscripts “th”, “nd”, “st”, and “rd” need to be appended to the day value. The programmer should not forget 1st, 2nd, 3rd, 4th; and then 11th, 12th, 13th, 14th; and 21st, 22nd, 23rd, and 24th.Testcases:Input:02 11 2021Output:11th February 202
Single File Programming QuestionProblem StatementAlex is working on a project to create a calendar inquiry system. The system needs to accept a month number as input (where January is 1, February is 2, and so on) and then output the number of days in that month. Alex decides to implement this using a switch statement in their programming language of choice.Alex also wants to ensure the system is robust. Therefore, it should handle invalid month numbers by displaying an appropriate error message. Note: For February, Alex plans to incorporate logic that considers both standard years (28 days) and leap years (29 days).Input format :The input consists of an integer representing the month number.Output format :The output prints the number of days in the entered month along with a descriptive message.If the entered month number is invalid, the output prints "Invalid month number."Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:1 ≤ Valid month number ≤ 12Sample test cases :Input 1 :7Output 1 :July has 31 days.Input 2 :2Output 2 :February has 28 or 29 days.Input 3 :18Output 3 :Invalid month number.Note :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.
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
Given a date check whether it is Valid or Invalid. If it is a valid date print "Valid" else "Invalid".INPUT:accept the date in this format - dd/mm/yyOUTPUT:Print "Valid" or "Invalid".
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.