从一个函数到另一个函数的移动值-Python
我正在学习有关Python的知识,我想将一些值从一个函数转移到另一个功能。
如果您在下面看。我想将用户输入从第一个功能传输,然后自动将其传输到下一个功能以逆转文本。我在这里寻找一些指导。我是编程的新手,所以如果我做了一些愚蠢的事情,请原谅我。
#below函数获取用户输入并存储IT
Def String Rreverse(): sext = input(“您要反向的值是什么?”)
返回sext
sext = string reververs()
#这个函数将字符串输入从上一个函数逆转 def反向(sext): 返回stext [:: - 1]
sext = reververs()
I am learning about python and I want to transfer some value from one function to another.
If you look below. I want to transfer the user input from the first function and then automatically transfer that to the next function to reverse the text. I am looking for some guidance here. I am new to programming so please forgive me if I have done something silly.
#Below function takes the users input and stores it
def stringreverse():
stext = input("What is the value you want to reverse?")
return stext
stext = stringreverse()
#This function reverses the string input from the previous function
def reverse(stext):
return stext[::-1]
stext = reverse()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)