This commit is contained in:
Mark McIntyre 2019-12-03 09:48:00 -05:00
commit 3d176560aa

32
is-he-saruman/is-he-saruman Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
import argparse
def parse_args():
argp = argparse.ArgumentParser()
argp.add_argument('name', help="Name to check if it is Saruman")
return argp.parse_args()
def main():
args = parse_args()
saruman_list = list("saruman")
name_list = [x for x in args.name if x]
matching_letters = list()
for letter in saruman_list:
if letter.lower() in name_list:
matching_letters.append(letter)
name_list.pop(name_list.index(letter))
if matching_letters == saruman_list:
print(f"{args.name} is Saruman!")
else:
print(f"{args.name} is not Saruman.")
if __name__ == "__main__":
main()