Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

πŸ“ Add docstrings to add-utils #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
coderabbitai wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from coderabbitai/docstrings/ef04b8d
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
37 changes: 37 additions & 0 deletions simple_utils.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# simple_utils.py - A tiny utility library

def reverse_string(text):
"""
Return a new string with the characters of the input string in reverse order.

Parameters:
text (str): The string to be reversed.

Returns:
str: The reversed string.
"""
return text[::-1]

def count_words(sentence):
"""
Count the number of words in a sentence by splitting on whitespace.

Parameters:
sentence (str): The input string to analyze.

Returns:
int: The number of words found in the sentence.
"""
return len(sentence.split())

def celsius_to_fahrenheit(celsius):
"""
Convert a temperature from Celsius to Fahrenheit.

Parameters:
celsius (float): Temperature value in degrees Celsius.

Returns:
float: Equivalent temperature in degrees Fahrenheit.
"""
return (celsius * 9/5) + 32

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /