c_id = ['65536', '32768', '16384', '98304']
names = ['Maggie', 'Cody', 'Eric', 'Tina']
while True:
print('冲浪者名单:')
for i in range(len(c_id)):
print(c_id[i] + ':' + names[i])
opt = input('1表示“增加冲浪者信息”;2表示“修改冲浪者姓名”;3表示“删除冲浪者信息”;4表示“退出”。请输入:')
if opt == '1':
new = input('输入一个新的冲浪者姓名:')
names.append(new)
m = input('输入新冲浪者的ID:')
c_id.append(m)
elif opt == '2':
a = input('输入要修改姓名的冲浪者的ID:')
c = c_id.index(a)
print('你要修改的是:' + names[c])
chg = input('输入修改后的姓名:')
names[c] = chg
elif opt == '3':
p = input('输入要删除的冲浪者的ID:')
c = c_id.index(p)
print('你删除的冲浪者是:' + names[c])
names.pop(c)
c_id.pop(c)
elif opt == '4':
break
else:
print('输入错误,请输入1、2、3中的一个数字。')