def lastLetters(words)来自我的代码之外的错误

问题描述 投票:0回答:1

我应该做一个函数,该函数从输入中获取最后两个字母,并打印输出,该输出仅显示最后两个字母,但在中间用空格反转。我在一个环境中成功完成此操作,但它给了我一个在我可操作的空间之外的hackerrank平台上出现eof错误

    def my_func():
        words = input()
        a = words
        print(a[-1],a[-2])

    my_func()

我应该以输入示例“ hello”为例,输出为“ o l”这可以在我第一次编写它的手机上使用,但是在hackerrank平台上的预先编写的代码中从一行给出了eof错误

python-3.x string slice
1个回答
0
投票
Tambem estou com problemas nesse teste testeVocêconseguiu解析器?
© www.soinside.com 2019 - 2024. All rights reserved.