Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone determine how the following Java code would look in python? //Assuming EMP_ID maximum can hold 7 alphanumeric characters import java.util.Scanner; public class EMPValidation

Can someone determine how the following Java code would look in python?

//Assuming EMP_ID maximum can hold 7 alphanumeric characters

import java.util.Scanner;

public class EMPValidation {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter Emp ID: ");

String empID = in.nextLine();

System.out.println("IsValid: "+ isValid(empID));

}

public static boolean isValid(String empID){

if ((empID.length()<1) || (empID.length()>7)) {

return false;

}

else {

String empPattern= "^[a-zA-Z0-9]*$";

return empID.matches(empPattern);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions