運行變成這個樣子
>>> def first(s):
...? ? ? ? ? ? return s[:1].upper() + s[1:]
...? ? ? print first('hello')
? File "<stdin>", line 3
? ? print first('hello')
? ? ? ? ^
SyntaxError: invalid syntax
>>>
>>> def first(s):
...? ? ? ? ? ? return s[:1].upper() + s[1:]
...? ? ? print first('hello')
? File "<stdin>", line 3
? ? print first('hello')
? ? ? ? ^
SyntaxError: invalid syntax
>>>
2019-05-15
舉報
2020-03-09
你安裝的是python3.*版本的吧,print()函數是標準模式
2019-06-02
應該是第3行代碼要回車兩行跳出循環
2019-05-17
>>> def first(s):
...???? return s[:1].upper() + s[1:]
...
>>> print(first('hello'))
Hello
>>>
2019-05-16
有沒有什么縮進不對的地方,我運行成功了