In Python, conditional statements consist of if
, if-else
, and if-elif-else
:
|
|
|
|
|
Recursion is just as elegant in Python! Below is the well known Fibonacci function.
|
Use conditionals and recursion to write a function palindrome(string)
, which should return True
if the input string is a palindrome and False
otherwise. Write the function in your lab1.py
file. When you want to test your solution, enter the following command:
python3 autograder.py lab1.py