接受5个学生名字通过参数参数传递到函数内部 存储到列表中然后打印出每个学生名字中的首字符
def print_initial(names): for name in names: print(name[0])
students = [] for i in range(5): student_name = input("请输入学生名字: ") students.append(student_name)
print_initial(students)
原文地址: http://www.cveoy.top/t/topic/h4ls 著作权归作者所有。请勿转载和采集!