[old] Monkey Typing

[old] Monkey Typing

Undefined
DE EL EN ES FR IT JA PT-BR RU UK 简体中文

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

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

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

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

让我们假设我们的猴子不断地打字,它们打出了各种各样的文字片段。我们来尝试找到其中有意义的词汇。

你将得到一些可能含有有意义的词汇的文本。你需要统计在给出文本中包含的词汇数量。一个词汇可能是一个整体或者另一个词汇的一部分。检查文本时不区分大小写,你需要检查的词汇将被以小写形式给出且不会重复。如果一个词在文本中出现多次,你只需要计数一次。

举个例子,文本:"How aresjfhdskfhskd you?",词汇:("how", "are", "you", "hello")。输出结果是3。

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

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

范例:

countWords("How aresjfhdskfhskd you?", ["how", "are", "you", "hello"]) == 3
countWords("Bananas, give me bananas!!!", ["banana", "bananas"]) == 2
countWords("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.
19
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
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=js 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.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
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