/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 23ms 3.996 MiB

Code

# Import the re module for regular expressions
import re

# Define a function to check the validity of a password
def is_valid(password):
  # Use re.search to check if the password contains at least one lowercase letter
  if not re.search("[a-z]", password):
    return False
  # Use re.search to check if the password contains at least one uppercase letter
  if not re.search("[A-Z]", password):
    return False
  # Use re.search to check if the password contains at least one digit
  if not re.search("[0-9]", password):
    return False
  # Use re.search to check if the password contains at least one special character
  if not re.search("[!@#$%^&*()]", password):
    return False
  # Use len to check if the password has a minimum length of 8 characters
  if len(password) < 8:
    return False
  # If all the conditions are met, return True
  return True

# Take the input of the number of cases to check
T = int(input())

# Use a for loop to iterate over T times
for i in range(T):
  # Take the input of the password string
  password = input()
  # Call the validity function with the password string
  valid = is_valid(password)
  # Print the output accordingly
  if valid:
    print("valid.")
  else:
    print("invalid.")

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Language
Python 3 (Python 3.12.3)
Submit At
2023-12-31 12:23:09
Judged At
2024-11-11 03:46:51
Judged By
Score
0
Total Time
23ms
Peak Memory
3.996 MiB