2015年8月6日木曜日

開発環境

  • OS X Yosemite - Apple (OS)
  • Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
  • Python 3.4 (プログラミング言語)

Python for Kids: A Playful Introduction to Programming (Jason R. Briggs (著) 、No Starch Press)のPart Ⅰ.(Learning to Program)、Chapter 9.(Python's Built-in Functions)、Programming Puzzles #2: Turtle PitchforkHidden Message(No. 2455)を解いてみる。

Programming Puzzles #2: Turtle PitchforkHidden Message(No. 2455)

コード(Emacs, BBEdit)

#!/usr/bin/env python3
#-*- coding: utf-8 -*-

s = 'this if is you not are a reading very this good then way you to hide done a it message wrong'

words = s.split()

for i in range(0, len(words), 2):
    print(words[i], end=' ')
print()

for i in range(1, len(words), 2):
    print(words[i], end=' ')
print()

入出力結果(Terminal, IPython)

$ ./sample2.py
this is not a very good way to done it wrong 
if you are reading this then you hide a message
$

0 コメント:

コメントを投稿