g1c555
发表于 2017-9-5 14:26:51
whqt
樱花冷雨
发表于 2017-9-6 16:40:45
新手学习{:5_109:}
qiulan
发表于 2017-9-7 15:28:00
看中文
老甲鱼与小甲鱼
发表于 2017-9-10 16:59:51
看看...
shigure_takimi
发表于 2017-12-5 10:22:54
def fun(name):
name = name.lower()
newName = ''
if not name == name[-1]:
newName = 'The ' + name.capitalize()
else:
newName = (name+name[:]).capitalize()
print('{0}-->{1}'.format(name, newName))
fun('dolphin')
fun('alasaka')
fun('europe')
yjsx86
发表于 2018-1-27 02:44:20
本帖最后由 yjsx86 于 2018-1-27 02:51 编辑
def func(name):
return '%s%s' % (name.capitalize(),name) if name == name[-1] else 'The %s' % name.capitalize()
363365143
发表于 2018-2-18 18:24:55
看看中文题目
grf1973
发表于 2018-4-20 10:20:28
看题看题
奔跑的烩面
发表于 2018-4-22 19:34:04
看一看
咕咕鸡鸽鸽
发表于 2019-2-25 22:21:32
围观
lwy520
发表于 2019-2-25 23:18:52
def band_name_set(band_name):
band_name=band_name.lower()
if band_name==band_name:
print(band_name.upper()+band_name*2)
else:
print("The " + band_name.upper()+band_name)
band_name=input('请输入一个名词作为"band name":')
band_name_set(band_name)
yx304085051
发表于 2019-2-26 09:01:28
def fun(msg):
msg.lower()
if msg == msg[-1]:
return msg.title() + msg
else:
return 'The %s' % msg.title()
print(fun('dolphin'))
print(fun('alaska'))
print(fun('europe'))
永恒的蓝色梦想
发表于 2019-8-18 15:50:58
本帖最后由 永恒的蓝色梦想 于 2019-8-22 11:19 编辑
lambda s:(s.title()+s)if s==s[-1] else 'The '+s.title()
kelby
发表于 2019-8-18 19:46:42
加油
kaishao
发表于 2019-8-18 20:56:49
嗯,先看看
克里斯保罗
发表于 2019-9-24 07:11:49
def band(name:str):
answer = ''
if name != name[-1]:
answer = 'The '+name
else:
answer = name.capitalize() +name
return answer
print(band('alaska'))
Geoffreylee
发表于 2020-3-11 16:38:33
def f_75(string: str) -> str:
return 'The ' + string.capitalize() if string != string[-1] else string.capitalize() + string
print(f_75('alaska'))
holiday_python
发表于 2020-6-28 22:34:39
def name_band(st):
if st != st[-1]:
return 'band\'s name is The ' + st.title()
else:
return st.title() + st
st = input('请输入乐队名称: ')
#print(name_band(dolphin))
print(name_band(st))
riodavid
发表于 2020-6-28 23:08:30
name = input("Please input your name: ")
cap_name = name.capitalize()
if name == name:
name_final = cap_name + name.strip(name) + name
else:
name_final = "The " + cap_name
print(name_final)
19971023
发表于 2020-7-30 10:30:33
1