lst = [] while True: s = input() if s == '.': break try: num = int(s) lst.append(num) except: print('输入格式错误,请输入整数。')

if not lst: print('无输入数据。') else: print('列表的长度为:', len(lst)) print('列表中的最小值为:', min(lst))

Python 列表数据输入、长度和最小值计算

原文地址: https://www.cveoy.top/t/topic/ovoq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录