Created
August 16, 2014 04:34
-
-
Save yuheiomori/8e2333c06c2b5328de6f to your computer and use it in GitHub Desktop.
Roller Coaster (CodeEval) in Python 3.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import sys | |
def main(): | |
with open(sys.argv[1], "r") as f: | |
for line in f: | |
upper_flg = True | |
for s in line: | |
if s.isalpha(): | |
if upper_flg: | |
sys.stdout.write(s.upper()) | |
else: | |
sys.stdout.write(s.lower()) | |
upper_flg = not upper_flg | |
else: | |
sys.stdout.write(s) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment