Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中向后打印单词?_Python - Fatal编程技术网

如何在python中向后打印单词?

如何在python中向后打印单词?,python,Python,如何在Python中向后打印单词?例如,如果我有: word = input("Enter a word: ") 如何使该打印向后?最简单的一种,使用: #驱动程序值: IN : word = 'abcd' OUT : 'dcba' 最简单的方法是使用: #驱动程序值: IN : word = 'abcd' OUT : 'dcba' 试试这个: a=input() print ("".join(reversed(a))) 试试这个: a=input() print ("".join(r

如何在Python中向后打印单词?例如,如果我有:

word = input("Enter a word: ") 
如何使该打印向后?

最简单的一种,使用:

#驱动程序值:

IN : word = 'abcd'
OUT : 'dcba'
最简单的方法是使用:

#驱动程序值:

IN : word = 'abcd'
OUT : 'dcba'
试试这个:

a=input()
print ("".join(reversed(a)))
试试这个:

a=input()
print ("".join(reversed(a)))

嘿Kaushik你能详细解释一下逻辑吗?这个解决方案看起来很可爱。@ThatRockBottom程序员:检查我的编辑。已经发布了链接供进一步阅读。嘿,考希克,你能详细说明一下逻辑吗?这个解决方案看起来很可爱。@ThatRockBottom程序员:检查我的编辑。已发布链接以供进一步阅读。