def second_largest(nums):
if len(set(nums)) < 2:
return None
unique_nums = list(set(nums))
unique_nums.sort()
return unique_nums[-2]
# Example Usage
print(second_largest([4, 2, 6, 6, 2, 1])) # Output: 4
print(second_largest([7])) # Output: None
ZGVmIHNlY29uZF9sYXJnZXN0KG51bXMpOgogICAgaWYgbGVuKHNldChudW1zKSkgPCAyOgogICAgICAgIHJldHVybiBOb25lCiAgICB1bmlxdWVfbnVtcyA9IGxpc3Qoc2V0KG51bXMpKQogICAgdW5pcXVlX251bXMuc29ydCgpCiAgICByZXR1cm4gdW5pcXVlX251bXNbLTJdCgojIEV4YW1wbGUgVXNhZ2UKcHJpbnQoc2Vjb25kX2xhcmdlc3QoWzQsIDIsIDYsIDYsIDIsIDFdKSkgICMgT3V0cHV0OiA0CnByaW50KHNlY29uZF9sYXJnZXN0KFs3XSkpICAjIE91dHB1dDogTm9uZQ==