ahmet / Python-for-Data-Science
Herkese Açık Ahmet Kerem Piscine Final
filterstring.py 515 B
import sys
from ft_filter import ft_filter
def main() -> None:
"""Print the words of S (arg 1) longer than N (arg 2)."""
try:
if len(sys.argv) != 3:
raise AssertionError("the arguments are bad")
words = [word for word in sys.argv[1].split()]
number = int(sys.argv[2])
print(ft_filter(lambda word: len(word) > number, words))
except (AssertionError, ValueError):
print("AssertionError: the arguments are bad")
if __name__ == "__main__":
main()