# names=['OBOS','age','Alice']
# l=[]
# for name in names:
# name=name.upper()
# l.append(name)
#
# print(l) # ['OBOS', 'AGE', 'ALICE']
#
# names=['OBOS','age','Alice']
# l=[]
# for name in names:
# name=name.upper()
# l.append(name)
#
# names=l
# print(names) # ['OBOS', 'AGE', 'ALICE']
# names=['OBOS','age','Alice']
# names=[name.upper()for name in names]
# print(names) # ['OBOS', 'AGE', 'ALICE']
# names=['OBOS','age','Alice']
# s=[name for name in names if name.endswith('ge')]
# print(s) # ['age']
# obj=list('qwertyuio')
# print(obj) # ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o']
# print(max([1,2,3,4,5,6,7,8])) # 8
# g=(i for i in range(10))
# print(max(g))
# print(max(g))
'''
Traceback (most recent call last):
9
File "D:/text/声明式编程小练习.py", line 33, in <module>
print(max(g))
ValueError: max() arg is an empty sequence
'''
# g=(i for i in range(10))
# print(max(g))
# g=(i for i in range(10))
# print(max(g))
'''
9
9
'''
# with open('b.txt','r',encoding='utf-8') as f:
# l=[]
# for line in f:
# # print(len(line))
# l.append(len(line))
#
# print(l)
# print(max(l))
'''
[23, 11, 17, 17, 161, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1]
161
'''
# with open('b.txt','r',encoding='utf-8') as f:
# l=[len(line) for line in f]
# print(max(l)) # 161
# with open('b.txt','r',encoding='utf-8') as f:
# l=(len(line) for line in f)
# print(l)
# print(max(l))
'''
<generator object <genexpr> at 0x0000021C4BBFE7C8>
161
'''
# with open('b.txt','r',encoding='utf-8') as f:
# # # l=(len(line) for line in f)
# # # print(l)
# # # print(max(l))
# # print((len(line) for line in f))
# # print(max(l))
# print(max(len(line) for line in f)) # 161
# with open('b.txt','r',encoding='utf-8') as f:
# # print(sum([len(line) for line in f])) # 383
# print(sum(len(line) for line in f)) # 383