Monkey Typing Monkey Typing
Elementary+
DE ES PT-BR UK Simplified Chinese EN EL FR IT JA RU
We have prepared a set of Editor's Choice Solutions. You will see them first after you solve the mission. In order to see all other solutions you should change the filter.

……如果让我的指头漫无目的地在打字机的按键上面移动,那么我的长篇大论就可能变成一段明白易懂的话语。如果一队猿猴在许多打字机上乱按一气,它们也有可能写出大英博物馆里所有的书籍,它们这样做的机会肯定地比分子恢复到容器一半的机会要更多。

A. S. 爱丁顿,《物理世界的本质》,1927。

“福特!”他说,“外面有无数只猴子想要进来和咱们讨论他们创作的剧本《哈姆雷特》。”

道格拉斯·亚当斯,《银河系漫游指南》。

无限猴子定理 是指让一只猴子在打字机上随机地按键,当时间无穷时,几乎必然能够打出任何给定的文字,例如 约翰·沃利斯 ... 的全套著作,也有可能是一部 的小说。

输入: 两个参数。一段文字作为字符串(str)输入,一组词汇作为一组字符串(a set of strings)输入。

输出: 文本中相关词汇的数量,整数(int)。

范例:

count_words("How aresjfhdskfhskd you?", {"how", "are", "you", "hello"}) == 3
count_words("Bananas, give me bananas!!!", {"banana", "bananas"}) == 2
count_words("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
            {"sum", "hamlet", "infinity", "anything"}) == 1

如何应用: Python在处理文本时有用且强大。这个任务是你未来可能编写的文字搜索工具的一个简单示范。

前提:
0 < len(text) ≤ 256
all(3 ≤ len(w) and w.islower() and w.isalpha for w in words)

You should be an authorized user in order to see the full description and start solving this mission.

Become Awesome

  • No Ads
  • No Limits
  • More Content
Settings
Code:
Other:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission