如何检测字符串中的下划线,还有如果又有大写又有小写又该怎么判断(大写不是首位的情况)

password = input()
level = []
for l in password:
if l.isupper():
level.append('up')
if l.islower():
level.append('low')
if l == '_':
level.append('_')
if l.isdigit():
level.append('int')
print(len(set(level)))