以相反的顺序读取输入和 return 三个字符串(目前只有 1 个字符串)

Read input and return three strings in reverse order (only 1 string so far)

def rev(one, two, three):
    print("Reverse of the third string is",three[::-1])

# returning concatenation of first two strings
    return one+two

def main():

    # Taking user input of 3 strings
    first = input("Enter first string:")
    second = input("Enter second string:")
    third = input("Enter third string:")


    # calling function, passing three arguments
    print("Reverse of third string is",rev(first, second, third))

main()

作业

如果字符串的输入是 Hello、World 和 Car,那么输出应该是 raCdlroWolleH

您的 rev 函数可以只包含一行代码(您应该在 main 函数中调用它)。它很简单:

return three[::-1]+two[::-1]+one[::-1]

我认为问题在于您要打印两份分开的照片,一份用于前两个单词,另一份用于第三个单词。如果你假装是把这三个词和return那个都连起来,那么你所要做的就是

新=一+二+三

return 新建[::-1]