Skip to content
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

New functions. #14

Closed
wants to merge 4 commits into from
Closed

New functions. #14

wants to merge 4 commits into from

Conversation

MKM12345
Copy link
Contributor

What's in this usefulib?

In this usefulib are two new functions:
The is_palindrome() function takes a string as input and checks whether it is a palindrome. A palindrome is a word, phrase, number, or sequence of characters that reads the same forward and backward (ignoring punctuation, and capitalization), such as "racecar" or "A man, a plan, a canal, Panama!". The function first converts the input string to lowercase and treats whitespaces as characters. It then checks whether the resulting string is equal to its reverse, and returns True if it is, or False otherwise.

The calculate_fibonacci() function takes a non-negative integer n as input and calculates the nth number in the Fibonacci sequence using recursion. The Fibonacci sequence is a series of numbers in which each number (starting from the third number) is the sum of the two preceding numbers. For example, the first ten numbers in the Fibonacci sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34. The calculate_fibonacci() function uses recursion to calculate the nth number in the sequence by recursively calling itself with n-1 and n-2 as inputs until it reaches the base case of n=0 or n=1, at which point it returns the corresponding value in the sequence (0 or 1). The function returns the nth number in the sequence.

Did you add tests?

Yes, I was able to with the (self).

Does this solve an issue?

No, just adds 2 functions.

Checklist

@MKM12345
Copy link
Contributor Author

MKM12345 commented Apr 30, 2023

After two failures (this one and this), I have finally resolved everything and is ready to merge.

@MKM12345 MKM12345 closed this Apr 30, 2023
@hamdivazim
Copy link
Owner

Hi @MKM12345, #15 has added your changes and is asking that you close this. Is this fine?

@MKM12345
Copy link
Contributor Author

Look what I have said. Thanks

hamdivazim pushed a commit that referenced this pull request May 1, 2023
convert_base() and usefulibs from #14
hamdivazim added a commit that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants