it works
This commit is contained in:
commit
3d176560aa
32
is-he-saruman/is-he-saruman
Executable file
32
is-he-saruman/is-he-saruman
Executable 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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user