Preparing git repo for final project
This commit is contained in:
16
problems/pset2/camel/camel.py
Normal file
16
problems/pset2/camel/camel.py
Normal file
@@ -0,0 +1,16 @@
|
||||
def main():
|
||||
camel_string = input("camelCase:\t\t")
|
||||
print(f"snake_case:\t\t{convert_to_snake_case(camel_string)}")
|
||||
|
||||
|
||||
def convert_to_snake_case(s: str):
|
||||
result = ''
|
||||
for char in s:
|
||||
if char == char.upper():
|
||||
result += '_'
|
||||
result += char.lower()
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user