当前位置 :
python问题首字母缩写Acronyms(首字母缩写词)Writeaprogram(inafilecalledacronyms.py)thatasksauserforaphraseandprintstheacronymofthatphrase.Youprogramshouldignorethewordsthe,of,andat.Herearesomeexamples:
更新时间: 2025-08-22 02:16:44
1人问答
问题描述:

python问题首字母缩写

Acronyms

(首字母缩写词)

Writeaprogram(inafilecalledacronyms.py)thatasksauserforaphraseandprintstheacronymofthatphrase.Youprogramshouldignorethewordsthe,of,andat.Herearesomeexamples:

(写一个程序(一个名为acronyms.py),要求用户一个短语,并打印出这句话的缩写.你的程序应该忽略的话,和.下面是一些例子:)

inputoutput

UniversityofBritishColumbiaUBC

AlexanderCollegeAC

SimonFraserUniversitySFU

MassachusettsInstituteofTechnologyMIT

Seeyoulatersyl

Berightbackbrb

Talktoyoulaterttyl

陈文胜回答:
  你好!你问了同样的问题,以下是我的程序:   phrase=raw_input("Enteraphrase:")   words=phrase.split("")   letters=[]   foriinwords:   ifi=="the"ori=="at"ori=="of":   words.remove(i)   foriinwords:   letters.append(i[0])   print"".join(letters)   希望可以帮到你,如果不懂可追问,还有其他要求也可以提问,望采纳!
最新更新
保卡通(baokatong.com)汇总了汉语字典,新华字典,成语字典,组词,词语,在线查字典,中文字典,英汉字典,在线字典,康熙字典等等,是学生查询学习资料的好帮手,是老师教学的好助手。
声明:本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
Copyright©2009-2021 保卡通 baokatong.com 版权所有