Python的一些基础概念题
作业1:声明列表、元组、字典、字符串 要求:以自己的学号和姓名做值
#列表
list_student = ['f11231632', '大宁子 ']
print(list_student)
#元组
tuple_student = ('f11231632', '大宁子 ')
print(tuple_student)
#字典
key1 = ['f12311632']
value1 = ['大宁子 ']
dict_student = dict(zip(key1, value1))
print(dict_student)
str_student_number = 'f12311632'
str_student_name = '大宁子 '
print(str_student_number, str_student_name)
作业2:使用列表生成10位同学的姓名、学号,将姓名、学号对应生成字典
key2 = ['f12311632', 'f12311602', 'f12311603', 'f12311604', 'f12311605',\
'f12311606', 'f12311607', 'f12311608', 'f12311609', 'f12311610']
value2 = ['大宁子', '托大尼', '皮小特', "赵小燕", '大毛', '二毛', '高小数', '英大语', '拍小森', '线大代']
dict_student_number = dict(zip(key2, value2))
print(dict_student_number)
作业3:使用range函数生成序号对应姓名生成字典
key3 = range(1, 5)
value3 = ['高小数', '英大语', '拍小森', '线大代']
dict_range = dict(zip(key3, value3))
print(dict_range)