続・えちごやん個人メモのブログ

えちごやん個人メモの移転先...。

Exercise Practical Computing for Biologists. Python basic I

http://people.duke.edu/~ccc14/pcfb/python1.html#exercise

Exercise

It is claimed by an interviewer that the majority of computer science graduates cannot write a correct solution to this problem (http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/). Are you better than the average computer science graduate?

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

You should save your program in a text editor and execute it as shown above. You can experiment within ipython, and copy and paste working code from ipython into the text editor. The instruction history -n startline:stopline shows you code in your history without the line numbers that is convient for cutting and pasting. Do it in stages - first, how do you print the numbers from 1 to 100? Next, how do you find multiples of 3? How do you change what is printed if the number is a multiple of 3? And so on ...

----

なかなか、良い教材だとは、思うが、どうしたもんかね。


ーーーー

LaTeX2HTML can be installed from the source archive, but onlyafter munging one of the files in the distribution.

LaTeX2HTML はソースアーカイブからのインストールもできますが、配布物中のあるファイルをいじってからでないとできません。 - Python

munging: いじるの”いじっ”。