mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
feat(solutions): add acronyms/python/function
This commit is contained in:
parent
2b0ff4b877
commit
eafb394187
3
challenges/acronyms/solutions/python/function/README.md
Normal file
3
challenges/acronyms/solutions/python/function/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# acronyms/python/function
|
||||
|
||||
Created by [@Divlo](https://github.com/Divlo) on 30 June 2021.
|
17
challenges/acronyms/solutions/python/function/solution.py
Normal file
17
challenges/acronyms/solutions/python/function/solution.py
Normal file
@ -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]))
|
Loading…
Reference in New Issue
Block a user