def sequencedSymbols(self, _str): #What is a sequential symbol? Ascending ascii? Ascending unicode? No, Only keyboard layout matters deduction = 0 for i in range(len(_str)-2): if CharUtils.isSymbol2(_str[i]) and CharUtils.isSymbol2(_str[i+1]) and CharUtils.isSymbol2(_str[i+2]): #all three are symbols if CharUtils.numberSymbol[_str[i]] == CharUtils.numberSymbol[_str[i+1]]-1 and CharUtils.numberSymbol[_str[i+1]] == CharUtils.numberSymbol[_str[i+2]]-1: # this is madness. checks dictionary of symbols mapped to ints deduction += 1 return deduction
def countSymbols(self, _str): symbols = 0 for char in _str: if CharUtils.isSymbol(char): # if it isn't a number, alpha, or space, it should be something weird(symbol) symbols += 1 return symbols