我想使用乌龟功能写出我输入的内容
我已经制作了一根乌龟绳来制作aphabet中的每个字母,并将它们分配给函数,因此我只需要打印一个()才能写出一个A。但是,我想知道的是,是否可以让用户输入句子或单词,然后搜索输入并找到所有使用的字母,然后打印那些相应的功能,以打印输入中所述的内容。我不知道这是否可能是可能的,但是如果是,我想知道如何。 先感谢您。
i have already made a turtle string to make every letter in the aphabet, and assigned them to functions, so i only have to print a() for it to write out an A for example. but what im wondering is if it is possible to have the user input a sentence or word, and then search through the input and find all letters used, then print those corresponding functions, to print out what is said in the input. i have no idea if this is even possible, but if it is i would like to know how.
thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个简单的方法是使用乌龟写功能。
Turtle.done()在乌龟运行后可见可见。
如果您想为每个字母使用单独的功能,则需要将输入分为字母,并将其调用如评论中提到的函数。此方法称为调度表。请编辑您的问题,以显示您到目前为止尝试的尝试。
An easier way to do this is to use the turtle write function.
turtle.done() is there to keep the turtle screen visible after it runs.
If you want to use a separate function for each letter you will need to split your input into letters and call the functions like was mentioned in the comments. This approach is called a dispatch table. Please edit your question to show what you have attempted so far.