string.islower() 字符判断是不是小写字母
string.isupper() 字符判断是不是大写字母
string.isdigit() 字符判断是不是数字
# .islower():checks if all the characters in a string are lowercase.
text = "hello"
result = text.islower()
print(result) # Output: True
# .isupper():checks if all the characters in a string are uppercase.
text = "HELLO"
result = text.isupper()
print(result) # Output: True
# .isdigit():checks if all the characters in a string are digits (numeric characters).
number = "12345"
result = number.isdigit()
print(result) # Output: True
列表相减
# 方法一
list1 = [5, 3, 8, 6]
list2 = [2, 1, 3, 4]
result = [x - y for x, y in zip(list1, list2)]
print(result) # Output: [3, 2, 5, 2]
# 方法二
list1 = [5, 3, 8, 6]
list2 = [2, 1, 3, 4]
result = list(map(lambda x, y: x - y, list1, list2))
print(result) # Output: [3, 2, 5, 2]