Need help asking for an input sentence
조회 수: 3 (최근 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!