Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions python/simple_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# simple_utils.py - A tiny utility library
def reverse_string(text):
"""Return the reverse of the input string."""
return text[::-1]


def count_words(sentence):
"""Return the number of whitespace-separated words in the sentence."""
return len(sentence.split())


def celsius_to_fahrenheit(celsius):
"""Convert Celsius to Fahrenheit."""
return (celsius * 9 / 5) + 32