您如何连接headName
和tailName
?
name = input("What is your name? ")
def headName(name):
print((name)[:1].upper())
def tailName(name):
print((name)[1:].lower())
headName = str(headName(name))
tailName = str(tailName(name))
答案 0 :(得分:1)
如果通过连接你的意思是"胶水"两个函数的结果,因为它们是字符串,你可以使用" +"操作
name = input("What is your name? ")
def headName(name):
return((name)[:1].upper())
def tailName(name):
return((name)[1:].lower())
headName = str(headName(name))
tailName = str(tailName(name))
print(headName+tailName)