Need help asking for an input sentence
6 次查看(过去 30 天)
显示 更早的评论
Hi, I need to ask the user to insert a sentence. I have
N=input('what is N?: ')
A=input('give me a sentence!: ');
Once I run the code and insert any word I get an error that says invalid expression. How can I stop the error from popping up? I will also be asking the sentence prompt to repeat until a certain word or phrase is typed.
0 个评论
回答(1 个)
Akira Agata
2021-10-21
To input a text, you should use 's' option, like:
N = input('what is N?: ')
A = input('give me a sentence!: ','s');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!