# def page():
while True:
print('''/
=======================================================
??歡迎h(huán)ezhicheng:
?? 1. 添加學生
?? 2. 查看學生
?? 3. 修改學生信息
?? 4. 刪除學生
?? 5. 返回
=======================================================
''')
# page()
select = input('請選擇(1-5):')
students = []
def new_id():
"""學號"""
num = 1
while True:
yield 'python1809' + str(num)
num += 1
shi_id = new_id()
# print(next(shi_id))
# def add_the_student():
# """添加學生"""
if select == '1':
while True:
name = input('請輸入學生姓名:')
age = input('請輸入年齡:')
tel = input('請輸入學生電話:')
stu = shi_id
dict1 = {'stu': stu, 'name': name, 'age': age, 'tel': tel}
students.append(dict1)
print('''
添加成功踢关!
1.繼續(xù)
2.返回
''')
select1 = input('請選擇(1-2):')
if select1 != '1':
break
# print(add_the_student())
# def look_at_the_students():
# """查看學生"""
elif select == '2':
while True:
# print(students)
print('''
1.查看所有學生
2.按姓名查找
3.按學號查找
4.返回
''')
select2 = input('請選擇(1-4):')
if select2 == '1':
print(students)
elif select2 == '2':
import_name = input('請輸入姓名:')
for dict1 in students:
if import_name == dict1['name']:
print(dict1)
elif select2 == '3':
import2_stu = input('請輸入學號:')
for dict2 in students:
if import2_stu == dict2['stu']:
print(dict2)
else:
break
# def modify_student_information():
# """修改學生信息"""
elif select == '3':
while True:
print('''
1.修改名字
2.修改年齡
3.修改電話
4.返回
''')
select7 = input('請選擇(1-4):')
if select7 == '1':
name = input('請輸入名字:')
for dict1 in students:
if name == dict1['name']:
print(dict1)
new_name = input('請輸入修改后的名字:')
dict1['name'] = new_name
print('修改成功', dict1)
else:
print('沒有這個人7挠!致扯!')
break
elif select7 == '2':
name = input('請輸入名字:')
for dict1 in students:
if name == dict1['name']:
print(dict1)
new_age = input('請輸入修改后的年齡:')
dict1['age'] = new_age
print('修改成功', dict1)
else:
print('沒有這個人!!!')
break
elif select7 == '3':
name = input('請輸入名字:')
for dict1 in students:
if name == dict1['name']:
print(dict1)
new_tel = input('請輸入修改后的名字:')
dict1['tel'] = new_tel
print('修改成功', dict1)
else:
print('沒有這個人2╋!眶掌!')
break
else:
break
# def delete_the_student():
# """刪除學生"""
elif select == '4':
while True:
print('''
1.按學號刪除
2.按姓名刪除
3.返回
''')
select4 = input('請輸入(1-4):')
if select4 == '1':
new_stu = input('輸入學號:')
for dict1 in students:
if new_stu == dict1['stu']:
print(dict1)
print('''
1.確定刪除
2.返回
''')
select5 = input('請選擇(1-2):')
if select5 == '1':
students.pop(dict1)
else:
break
elif select4 == '2':
new_name = input('輸入姓名:')
for dict2 in students:
if new_name == dict2['name']:
print(dict2)
print('''
1.確定刪除
2.返回
''')
select6 = input('請選擇(1-2):')
if select6 == '1':
students.pop(dict2)
else:
break
else:
break
else:
break
學生管理系統(tǒng)簡潔版
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來痊银,“玉大人抵蚊,你說我怎么就攤上這事∷莞铮” “怎么了贞绳?”我有些...
- 文/不壞的土叔 我叫張陵,是天一觀的道長致稀。 經(jīng)常有香客問我冈闭,道長,這世上最難降的妖魔是什么抖单? 我笑而不...
- 正文 為了忘掉前任萎攒,我火速辦了婚禮,結果婚禮上矛绘,老公的妹妹穿的比我還像新娘耍休。我一直安慰自己,他們只是感情好货矮,可當我...
- 文/花漫 我一把揭開白布羊精。 她就那樣靜靜地躺著,像睡著了一般囚玫。 火紅的嫁衣襯著肌膚如雪园匹。 梳的紋絲不亂的頭發(fā)上雳刺,一...
- 文/蒼蘭香墨 我猛地睜開眼怔昨,長吁一口氣:“原來是場噩夢啊……” “哼雀久!你這毒婦竟也來了?” 一聲冷哼從身側響起趁舀,我...
- 正文 年R本政府宣布,位于F島的核電站赊级,受9級特大地震影響悦析,放射性物質發(fā)生泄漏。R本人自食惡果不足惜此衅,卻給世界環(huán)境...
- 文/蒙蒙 一强戴、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧挡鞍,春花似錦骑歹、人聲如沸。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春最域,著一層夾襖步出監(jiān)牢的瞬間谴分,已是汗流浹背。 一陣腳步聲響...
推薦閱讀更多精彩內容
- 【蝴蝶效應】 蝴蝶效應:上個世紀70年代暑竟,美國一個名叫洛倫茲的氣象學家在解釋空氣系統(tǒng)理論時說斋射,亞馬遜雨林一只蝴蝶...
- 一罗岖、專業(yè)性 1、 可詳細記錄零售客戶的驗光情況纱兑,及配鏡日期呀闻,生日等基本信息化借。 2潜慎、 可根據(jù)客戶資料打印信封。 3蓖康、...
- 前幾天,我無意得知了一個泳梆,打出生以來聽到的最令人激動的消息——iPhone官方開放降級通道鳖悠!幾乎所有機型都可以降級...