From 3d176560aae39b090dfc1f0d029b7b2f5a394459 Mon Sep 17 00:00:00 2001 From: mark mcintyre Date: Tue, 3 Dec 2019 09:48:00 -0500 Subject: [PATCH] it works --- is-he-saruman/is-he-saruman | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 is-he-saruman/is-he-saruman diff --git a/is-he-saruman/is-he-saruman b/is-he-saruman/is-he-saruman new file mode 100755 index 0000000..2d8bcbb --- /dev/null +++ b/is-he-saruman/is-he-saruman @@ -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() +