Created
October 12, 2013 05:13
-
-
Save santosh/6946096 to your computer and use it in GitHub Desktop.
Converts a "string" into "StRiNg".
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
#!/usr/bin/env python3 | |
#-*- coding: utf-8 -*- | |
from __future__ import print_function | |
import sys | |
var = sys.argv[1:] | |
def crazify(string): | |
"""Converts first index of string to uppercase followed by lowercase and so on. | |
""" | |
i = 0 | |
output = [] | |
for letter in string: | |
if i == 0: | |
output.append(letter.upper()) | |
i = 1 | |
elif i == 1: | |
output.append(letter.lower()) | |
i = 0 | |
return ''.join(output) | |
if __name__ == '__main__': | |
for word in var: | |
print(crazify(word), "", end='') | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment