diff --git a/challenges/acronyms/solutions/python/function/README.md b/challenges/acronyms/solutions/python/function/README.md new file mode 100644 index 0000000..f948cd8 --- /dev/null +++ b/challenges/acronyms/solutions/python/function/README.md @@ -0,0 +1,3 @@ +# acronyms/python/function + +Created by [@Divlo](https://github.com/Divlo) on 30 June 2021. diff --git a/challenges/acronyms/solutions/python/function/solution.py b/challenges/acronyms/solutions/python/function/solution.py new file mode 100644 index 0000000..49eb226 --- /dev/null +++ b/challenges/acronyms/solutions/python/function/solution.py @@ -0,0 +1,17 @@ +from typing import List +import sys + +input_values: List[str] = [] +for value in sys.stdin: + input_values.append(value.rstrip('\n')) + + +def get_acronym(sentence: str) -> str: + words = sentence.replace('"', '').split(' ') + acronym = '' + for word in words: + acronym += word[0].capitalize() + return acronym + + +print(get_acronym(input_values[0]))