Created
July 29, 2011 19:51
-
-
Save aranasaurus/1114582 to your computer and use it in GitHub Desktop.
First Level Question Answer
This file contains 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
import sys | |
def main(num1, out1, num2, out2, start, end): | |
for val in range(start, end): | |
is1 = val % num1 == 0 | |
is2 = val % num2 == 0 | |
out = '' | |
if is1: | |
out += out1 | |
if is2: | |
out += out2 | |
if is1 or is2: | |
print out | |
else: | |
print val | |
if __name__ == '__main__': | |
if len(sys.argv) >= 7: | |
main(int(sys.argv[1]), sys.argv[2], int(sys.argv[3]), sys.argv[4], int(sys.argv[5]), int(sys.argv[6])) | |
else: | |
if len(sys.argv) > 1: | |
print 'Invalid options given. Should be number1 output1 number2 output2 rangeStart rangeEnd' | |
else: | |
print 'Running with default values' | |
main(3, 'Dark', 5, 'Horse', 1, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment