Until you type stop · 直到输入 stop
Until you type stop
Read words one at a time until the word stop arrives, then report how many came before it.
Read the first word before the loop, so the condition has something to test. Inside the loop, count the word and then read the next one. When you press Run, type each word and press Enter.
直到输入 stop
一次读取一个单词,直到出现 stop,然后报告它之前有多少个单词。
在循环之前先读第一个单词,这样条件才有东西可以判断。在循环里,先计数,再读下一个单词。点击运行后,每输入一个单词就按回车。
Keep reading words with input() until the word is stop. Then print how many words came before · 在...之前 stop. For the words cat, dog, stop, print 2. · 用 input() 不断读取单词,直到读到 stop 为止。然后打印在 stop 之前有多少个单词。输入 cat、dog、stop 时,打印 2。
Click Run to see the output here. · 点击“运行”查看此处输出。