## Description
Your job is to create a simple password validation function, as seen on many websites. 

The rules for a valid password are as follows:
- There needs to be at least 1 uppercase letter.
- There needs to be at least 1 lowercase letter.
- There needs to be at least 1 number.
- The password needs to be at least 8 characters long.

You are permitted to use any methods to validate the password.

## Examples:

### Extra info
- You will only be passed strings.
- The string can contain any standard keyboard character.
- Accepted strings can be any length, as long as they are 8 characters or more.

Difficulty: introductory

Starter code:

def password(string):
	

Solutions:
CRITERIA = (str.islower, str.isupper, str.isdigit)

def password(s):
    return len(s)>7 and all( any(map(f,s)) for f in CRITERIA)

import re

def password(s):
    return bool(re.match(r'(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8}', s))

import re 

def password(string):
    patterns = (r'[A-Z]', r'[a-z]', r'[0-9]', r'.{8,}')
    return all([re.search(pattern, string) for pattern in patterns])

def password(candidate):
    """Returns True if 'candidate' password possesses arbitrary properties that do more than
       good for security of the users' accounts. It is probably accompanied by a password 
       field in which paste is disabled. Notice that a maximum character length is not specified.
       This is so we can silently truncate the users' passwords before hashing and storing
       them so that when they attempt to log in later, they have to guess how many characters
       we truncated. We might also do this differently on different clients so the same password
       works in some instances and fails in others. We will also impliment all this client side, 
       so the validation is easily defeated by anyone willing to monkey with our client-side script.
       Then we will add 'security questions' based on publicly available information, allowing
       anyone to sidestep authentication with a basic search.
       
       Otherwise, False.
    """
       
    if not len(candidate) >= 8:
        return False
    if not any(char.islower() for char in candidate):
        return False
    if not any(char.isupper() for char in candidate):
        return False
    if not any(char.isdigit() for char in candidate):
        return False
    return True 

def password(string):
    if len(string) >= 8:
        check = 0
        for c in string:
            if   c.isupper(): check |= 1
            elif c.islower(): check |= 2
            elif c.isdigit(): check |= 4
            if check == 7: return True
    return False

def password(s):
    return  any(c.isupper() for c in s) and \
            any(c.islower() for c in s) and \
            any(c.isdigit() for c in s) and \
            len(s)>7

import re
def password(string):
    
    return bool(re.match("^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$",string))

def lenfilt(func, seq):
    return len(list(filter(func, seq)))

def assrt(seq):
    funcs = [str.isupper, str.islower, str.isdigit, str]
    nums = [0, 0, 0, 7]
    return [lenfilt(i, seq) > j for i, j in zip(funcs, nums)]

def password(string):
    return all(assrt(string))

def password(string):
    #your code here
    k1 = k2 = k3 = 0
    if len(string) < 8:
        return False
    
    for i in string:
        if i.islower():
            k1 = 1
    for i in string:
        if i.isupper():
            k2 = 1
    for i in string:
        if i.isdigit():
            k3 = 1
    if k1 == k2 == k3 == 1:
        return True
    else:
        return False

def password(string):
  rules = [lambda s: any(x.isupper() for x in s),
          lambda s: any(x.islower() for x in s),  
          lambda s: any(x.isdigit() for x in s),
          lambda s: len(s) >= 8
          ]
          
  if all(rule(string) for rule in rules):
    return True
  else:
    return False