简体   繁体   English

输入响应后,有没有办法可以在控制台中重复显示 user_input 问题?

[英]Is there a way I can repeatedly display a user_input question in the console, after entering a response?

代码

How, after creating a user_input question and when inputting a response to the console, can I get the question to ask again, without having to run the script again?在创建 user_input 问题并向控制台输入响应后,如何在无需再次运行脚本的情况下再次询问问题?

Would I use a for/while loop for this?我会为此使用 for/while 循环吗? I have had a look around and tested some stuff out but I get errors or it doesn't work at all.我环顾四周并测试了一些东西,但出现错误或根本不起作用。 I'm fairly new to programming.我对编程相当陌生。 Thank you!谢谢!

Yes you should use a while loop for this.是的,您应该为此使用 while 循环。

Keep in mind that to learn programming, you have to move forward one small step at a time, especially in the beginnings.请记住,要学习编程,您必须一次一小步地向前迈进,尤其是在开始时。

So if you want to use a while loop, learn to use it separately in another tutorial.因此,如果您想使用 while 循环,请在另一个教程中学习单独使用它。 Only when you're confortable with 'while' and 'input / print', try to combine both.只有当您对“while”和“input / print”感到满意时,才尝试将两者结合起来。

If you keep this mentality for everything during your learning, you should grow fast !如果你在学习的过程中对任何事情都保持这种心态,你应该会快速成长!

Good luck !祝你好运 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM