-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathstring_utils.py
More file actions
48 lines (36 loc) · 1.5 KB
/
string_utils.py
File metadata and controls
48 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def str_len(str_in: str) -> str:
"""
Given a string parameter, this function should return the length of the parameter.
"""
pass # remove pass statement and implement me
def first_char(str_in: str) -> str:
"""
Given a string parameter, this function should return the first letter of the parameter.
"""
pass # remove pass statement and implement me
def last_char(str_in: str) -> str:
"""
Given a string parameter, this function should return the last letter of the parameter..
"""
pass # remove pass statement and implement me
def input_has_substring(str_in: str, sub_str_in: str) -> bool:
"""
This function determines if the substring exists within the string. Returns True or False.
"""
pass # remove pass statement and implement me
def substring(str_in: str, start: int, stop: int) -> str:
"""
Returns the substring of a string.
Keyword arguments:
str_in -- the string in which to generate a substring from
start -- starting position of the input parameter to start the substring (inclusive)
stop -- stopping position of the input parameter to stop the substring (exclusive)
"""
pass # remove pass statement and implement me
def opposite_case(str_in: str) -> str:
"""
Given a string parameter, this function returns the same string back with each letter having the opposite case.
Example:
When input = "Python" the function returns "pYTHON"
"""
pass # remove pass statement and implement me