All pastes #731350 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-10 00:05 UTC
rendered paste body
def charcheck(chara):
	sym = ['!','@','#','$','%','^','&','*','-','_']
	
	if(chara >= 'a' and chara <= 'z'):
		return 'char'
	if(chara >= 'A' and chara <= 'Z'):
		return 'caps'
	if(chara >= '0' and chara <= '9'):
		return 'digit'
	if(chara in sym):
		return 'sym'
	if(chara == " "):
		return 'space'
	

def password(pas):
	pas = list(pas)
	uniq = 0
	switch = 0
	types = ['char','caps','num','sym','space']
	used = []
	type = charcheck(pas[0])
	for x in xrange(len(pas)):
		if (charcheck(pas[x]) not in used):
			uniq = uniq + 1
			used.extend(charcheck(pas[x]))
		if (charcheck(pas[x]) != type):
			switch = switch + 1
		type = charcheck(pas[x])
	
	strength = (uniq * switch * len(pas))
	
	print strength