4
stars
1
forks
source link
AI class - 5.5d #8
Open
vmtmxmf5 opened 3 years ago
First word
first_word('Hello, I\'m Jae Hoon')
'Hello'
접기
```
def first_word(text : str):
text = text.replace(',', '').replace('.', '').strip()
text = text.split()
return text[0]
```
Say Hi
say_hi('Mike', 45)
접기
``` def say_hi(x, y): print(f'Hi! My name is {x} and I\'m {y} years old') ```Correct Sentences
correct_sen('greeting friends')
접기
``` def correct_sen(x): text = x[0].upper() + x[1:] if not text.endswith('.'): text += '.' return text ```