请教我的代码为什么打不出大写首字母
请问各位大神 我的哪里不对
def firstCharUpper(s):
a = s[0].upper
return str(a) + str(s[1:])
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
请问各位大神 我的哪里不对
def firstCharUpper(s):
a = s[0].upper
return str(a) + str(s[1:])
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2018-03-07
def firstCharUpper(s):
a = s[0].upper() #少了括号
return str(a) + str(s[1:])
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
#这样写就行
def firstCharUpper(s):
return s[0].upper() + s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')举报