
Convert this java code to python please! I'm currently creating a function that validates a person's birthday, if it's following the proper format and if they're of legal age. I'm creating a form using tkinter.
boolean MM = false;
boolean DD = false;
boolean YY = false;
String birthday;
birthday = textFieldBirthday.getText();
int month = Integer.parseInt(birthday.split("/")[0]);
int day = Integer.parseInt(birthday.split("/")[1]);
int year = Integer.parseInt(birthday.split("/")[2]);
if (day <= 31){
lblBirthdayFormat.setForeground(Color.green);
lblBirthdayFormat.setText("Valid Date"); DD = true;
}
else{
lblBirthdayFormat.setForeground(Color.red);
lblBirthdayFormat.setText("Invalid Date");
}
if (month <= 12 && month > 00 && DD == true){
lblBirthdayFormat.setForeground(Color.green);
lblBirthdayFormat.setText("Valid Date");
MM = true;
}
else{
lblBirthdayFormat.setForeground(Color.red);
lblBirthdayFormat.setText("Invalid Date");
}
if (year - 0 <= 04 || year - 0 > 23 && DD == true && MM == true){
lblBirthdayFormat.setForeground(Color.green);
lblBirthdayFormat.setText("Valid Date");
YY = true;
}
else{
lblBirthdayFormat.setForeground(Color.red);
lblBirthdayFormat.setText("Invalid Date");
}
if (MM == true && DD == true && YY == true){
lblBirthdayFormat.setForeground(Color.green);
lblBirthdayFormat.setText("Valid Date");
}
else{
lblBirthdayFormat.setForeground(Color.red);
lblBirthdayFormat.setText("Invalid Date");
}
if (DD == true && MM == true && YY == false){
lblBirthdayFormat.setForeground(Color.red);
lblBirthdayFormat.setText("Minors are not allowed.");
}

Step by stepSolved in 2 steps with 1 images

- NEED HELP PYTHON ONLY PLZZarrow_forwardIn certain programming languages, comments appear between delimiters such as (# and #). • A comment must begin with (# and end with #). • A comment may not contain #) inside the comment. • A comment's delimiters must be separate: (##) is a comment, (#) is not. For simplicity, assume that the alphabet is E = {a, b, (, ), #}). Give a regular expression that accepts comments.arrow_forwardin this code, the integer on each line shows the line number that is not part of code: what are the parameters of sum: ____ 1 public static int sum(int x, int y){ 2 int z = x +y; 3 return z; 4 } 5 public static void main(String[] args){ 6 … 7 sum(a+2, b); 8 … 9 }arrow_forward
- light } What is the output of this Java program? } class Driver { public static void main(String[] args) { int a = 6: int b = 6; int c = 5; int x = 1; if (a > 2) { } } if x = x + 600; (b> 3) { x = x + 60; } if (c < 9) { X = x + 5; System.out.print(x);arrow_forwarduse the JCreator program for code in picture and show the outputarrow_forwardInteger userValue is read from input. Assume userValue is greater than 1000 and less than 99999. Assign tensDigit with userValue's tens place value. Ex: If the input is 15876, then the output is: The value in the tens place is: 7 2 3 public class ValueFinder { 4 5 6 7 8 9 10 11 12 13 GHE 14 15 16} public static void main(String[] args) { new Scanner(System.in); } Scanner scnr int userValue; int tensDigit; int tempVal; userValue = scnr.nextInt(); Your code goes here */ 11 System.out.println("The value in the tens place is: + tensDigit);arrow_forward
- n this lab, you complete a prewritten Python program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts: The charge for all signs is a minimum of $35.00. The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character. If the sign is make of oak, add $20.00. No charge is added for pine. Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering.arrow_forwardUnderstanding ifStatements Summary In this lab, you complete a prewritten Java program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts: The charge for all signs is a minimum of $35.00. The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character. If the sign is made of oak, add $20.00. No charge is added for pine. Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering. Instructions 1. Ensure the file named HouseSign.java is open. 2. You need to declare variables for the following, and initialize them where specified: A variable for the cost of the sign initialized to 0.00 (charge). A variable for the number of characters initialized to 8 (numChars). A variable for the color of the characters initialized to "gold" (color). A variable for the…arrow_forwardmy assignment wants me to Convert the MileConversions program to an interactive application. Instead of assigning a value to the miles variable, accept it from the user as input. Something is wrong with my code My code is : { public static void main(String[] args) { Scanner inputDevice = new Scanner(System.in); final double INCHES_IN_MILE = 63360; final double FEET_IN_MILE = 5280; final double YARDS_IN_MILE = 1760; double miles = 4; double in, ft, yds; in = miles * INCHES_IN_MILE; ft = miles * FEET_IN_MILE; yds = miles * YARDS_IN_MILE; System.out.println(miles + " miles is " + in + " inches, or " + ft + " feet, or " + yds + " yards"); } }arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





