当前位置:考试网  > 试卷库  > 计算机类  > 等级考试  > 计算机二级  > Python语言程序设计  >  请用 Python 语言编写一个简易的通讯录管理程序。
试题预览

请用 Python 语言编写一个简易的通讯录管理程序。

查看答案
收藏
纠错
正确答案:

mydic={}

while True:

print("="*7," 通讯录管理系统 ","="*7)

print("1.增加姓名和手机 ")

print("2.删除姓名 ")

print("3.修改手机号 ")

print("4.查询所有用户 ")

print("5.根据姓名查找手机号 ")

print("6.退出")

print("="*29)

a=input("请选择要执行的项目: ")

if a=="1":

name=input("请输入联系人姓名: ")

tel=input("请输入手机号: ")

if tel.isdigit() and len(tel)==11:

mydic[name]=tel

print("当前手机内联系人: ",mydic)

else:

print("输入有误 ")

elif a=="2":

name=input("请输入要删除的姓名: ")

tel=mydic.pop(name)

print("已删除: "+name+tel)

print("当前手机联系人: ",mydic)

elif a=="3":

name=input("请输入要修改的手机号姓名: ")

tel=input("请输入新的手机号: ")

mydic[name]=tel

print("修改成功! ")

print("当前手机内联系人: ",mydic)

elif a=="4":

print("当前手机内联系人: ",mydic)

elif a=="5":

name=input("请输入要查询的联系人姓名: ")

print(name,mydic[name])

print("")

elif a=="6":

print("感谢使用通讯录系统 ")

break

else:

print("输入有误 ")

答案解析:

暂无解析

你可能感兴趣的试题

1.Thefailureofahigh-profilecholesteroldrughasthrownaspotlightonthecomplicatedmachinerythatregulatescholesterollevels.Butmanyresearchersremainconfidentthatdrugstoboostlevelsof'good'cholesterolarestilloneofthemostpromisingmeanstocombatspirallingheartdisease.

2.DrugcompanyPfizerannouncedon2Decemberthatitwascancellingallclinicaltrialsoftorcetrapib,adrugdesignedtoraiseheart-protectivehigh-densitylipoproteins(HDLs).Inatrialof15000patients,asafetyboardfoundthatmorepeoplediedorsufferedcardiovascularproblemsaftertakingthedrugplusacholesterol-loweringstatinthanthoseinacontrolgroupwhotookthestatinalone.

3.Thenewscameasakickintheteethtomanycardiologistsbecauseearliertestsinanimalsandpeoplesuggesteditwouldlowerratesofcardiovasculardisease."Therehavebeennoredflagstomyknowledge,"saysJohnChapman,aspecialistinlipoproteinsandatherosclerosisattheNationalInstituteforHealthandMedicalResearch(INSERM)inPariswhohasalsostudiedtorcetrapib."Thiscancellationcameasacompleteshock."

4.TorcetrapibisoneofthemostadvancedofanewbreedofdrugsdesignedtoraiselevelsofHDLs,whichferrycholesteroloutofartery-cloggingplaquestotheliverforremovalfromthebody.Specifically,torcetrapibblocksaproteincalledcholesterolestertransferprotein(CETP),whichnormallytransfersthecholesterolfromhigh-densitylipoproteinstolowdensity,plaque-promotingones.Statins,incontrast,mainlyworkbyloweringthe'bad'low-densitylipoproteins.

Underpressure

5.Researchersarenowtryingtoworkoutwhyandhowthedrugbackfired,somethingthatwillnotbecomeclearuntiltheclinicaldetailsarereleasedbyPfizer.Onehintliesinevidencefromearliertrialsthatitslightlyraisesbloodpressureinsomepatients.Itwasthoughtthatthismildproblemwouldbeoffsetbytheheartbenefitsofthedrug.Butitispossiblethatitactuallyprovedfatalinsomepatientswhoalreadysufferedhighbloodpressure.Ifbloodpressureistheexplanation,itwouldactuallybegoodnewsfordrugdevelopersbecauseitsuggeststhattheproblemsarespecifictothiscompound.OtherprototypedrugsthatarebeingdevelopedtoblockCETPworkinaslightlydifferentwayandmightnotsufferthesamedownfall.

6.ButitisalsopossiblethatthewholeideaofblockingCETPisflawed,saysMotiKashyap,whodirectsatherosclerosisresearchattheVAMedicalCenterinLongBeach,California.WhenHDLsexcretecholesterolintheliver,theyactuallyrelyonLDLsforpartofthisprocess.SoinhibitingCETP,whichpreventsthetransferofcholesterolfromHDLtoLDL,mightactuallycauseanabnormalandirreversibleaccumulationofcholesterolinthebody."You'reblockingaphysiologicmechanismtoeliminatecholesterolandeffectivelyconstipatingthepathway,"saysKashyap.Goingup

7.Mostresearchersremainconfidentthatelevatinghighdensitylipoproteinslevelsbyonemeansoranotherisoneofthebestroutesforhelpingheartdiseasepatients.ButHDLsarecomplexandnotentirelyunderstood.Oneapproveddrug,calledniacin,isknowntobothraiseHDLandreducecardiovascularriskbutalsocausesanunpleasantsensationofheatandtingling.Researchersareexploringwhethertheycanbypassthissideeffectandwhetherniacincanlowerdiseaseriskmorethanstatinsalone.Scientistsarealsoworkingonseveralothermeanstobumpuphigh-densitylipoproteinsby,forexample,introducingsyntheticHDLs."Theonlythingweknowisdeadinthewateristorcetrapib,notthewholeideaofraisingHDL,"saysMichaelMiller,directorofpreventivecardiologyattheUniversityofMarylandMedicalCenter,Baltimore.

Questions7-13

Matchtorcetrapib,HDLs,statinandCETPwiththeirfunctions(Questions8-13)..WritethecorrectletterA,B,CorDinboxes8-13onyouranswersheet.NBYoumayuseanylettermorethanonce.

7.Ithasbeenadministeredtoover10,000subjectsinaclinicaltrial.

8.Itcouldhelpridhumanbodyofcholesterol.

9.Researchersareyettofindmoreaboutit.

10.Itwasusedtoreducethelevelofcholesterol.

11.AccordingtoKashyap,itmightleadtounwantedresultifit'sblocked.

12.Itproducedcontradictoryresultsindifferenttrials.

13.ItcouldinhibitLDLs.Listofchoices

A.TorcetrapicB.HDLSC.StatinD.CETP

包舱人在飞机起飞前取消、变更包舱计划,无须承担由此产生的赔偿责任。

Wedon’tacceptpaymentinUSdollars.PleaseconcludethebusinessintermsofSwissfrancs.

Wearenowexportingstrawandwillowproducts,embroideries,porcelainwares,jadecarvings,antiques,Chinesepaintings,silkflowersandvariouskindsoftoysandgifts.

EnvironmentalProtection

热门试题 更多>
试题分类: Web程序设计
练习次数:0次
试题分类: 综合知识
练习次数:1次
试题分类: 综合知识
练习次数:0次
扫一扫,手机做题