本文共 3834 字,大约阅读时间需要 12 分钟。
波罗蜜多 python之旅
A shadow falls over the land. Hero after hero arises to confront the encroaching evil, yet hero after hero is mercilessly slain (or accepts an offer for a pretty sweet management gig). Now, only two things stand between the all-powerful Emperor and his plans of enslaving every sentient lifeform in existence: a dwarven office clerk and the Python programming language. Welcome to the world of Demons and Dwarves.
阴影笼罩着大地。 一个又一个又一个的英雄面对邪恶的侵略者崛起,但一个又一个的英雄却被残酷地杀害(或接受一份相当不错的管理合同)。 现在,在功能强大的皇帝与奴役存在的所有有生命力的计划之间,只有两件事:矮小的办公室文员和Python编程语言。 欢迎来到魔鬼与矮人的世界。
Demons and Dwarves is an introductory Python programming course in the form of a story that revolves around a puzzle. The first person to solve the puzzle with Python is the winner and, in addition to unlocking the story’s ending and having their name and code memorialized there, gets to choose which charity to have $500 donated to. There are eight chapters in total which will be published one or two at a time over the course of several weeks.
《恶魔与矮人》是一门介绍Python编程的入门课程,其内容围绕一个难题展开。 第一个使用Python解决难题的人是获胜者,除了解锁故事的结尾并在其中纪念他们的名称和代码外,还可以选择将500美元捐赠给哪个慈善机构。 一共有八章,将在几周内一次出版一到两章。
Answers can be submitted as comments in the Prologue. If you get the correct answer, I’ll email you and ask for your code (via the email you have to provide when leaving a comment, which is only visible to me). The first person to reply to me with Python code that correctly works through every part of the puzzle is the winner. If you’re first to leave a comment with the correct answer but don’t provide your code, your code doesn’t check out, or you use a language besides Python, you won’t be declared the winner but you’ll still get an honorable mention.
答案可以在序言中作为评论提交。 如果您得到正确的答案,我会给您发送电子邮件并要求您提供验证码(通过在发表评论时必须提供的电子邮件(仅对我可见))。 赢家是第一个使用正确处理难题各个部分的Python代码回复我的人。 如果您是第一个提出正确答案的评论者,但不提供您的代码,则您的代码没有签出,或者您使用的是Python以外的语言,那么您将不会被宣布为获胜者,但您仍然会获得荣誉奖。
There are one or more hints in every chapter, some more subtle than others. It is possible to solve the puzzle without any hints, though by the time the eighth chapter is published the hints will have made the puzzle somewhat easier.
每章中都有一个或多个提示,其中一些提示比其他提示更微妙。 尽管没有任何提示,也可以解决难题,尽管到第八章出版时,这些提示将使难题更容易一些。
To get the most out of Demons and Dwarves you will want to not only run the code that occurs in the story as you read through it, but tinker with the code and test creative hypotheses about what might work and why. The more errors the merrier.
为了最大程度地利用“恶魔和矮人”,您不仅要运行故事中出现的代码,还要修改代码并测试关于什么可行以及为什么的创造性假设。 错误越多越好。
To run your code, you’re going to need a code editor. Here are a few options that I suggest:
要运行代码,您将需要一个代码编辑器。 我建议您使用以下几种方法:
If you’re brand new to programming, you may also want to read up on the difference between running code in , as the code in some parts of the story will be easier to run in a particular mode.
如果您是编程的新手,您可能还想了解以运行的代码运行的代码之间的区别,因为故事中某些部分的代码将更易于在特定模式下运行。
Leave a comment if you have any questions.
如有任何疑问,请发表评论。
GL HF
玻璃纤维
翻译自:
波罗蜜多 python之旅
转载地址:http://cnqwd.baihongyu.com/