Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy3 /
20120815ePalindrome Write a function that decides about a string if it's a palindrome. A string is said to be palindrome if it reads the same backwards as forwards, e.g. madam. Solve the exercise in different ways: (1) Trivial method (in Python it's very easy to reverse a sequence). (2) Iterative method. You are not allowed to make a copy of the string. Tip: you can use a i = 0 while i < 5: print(i) i += 1 (3) Recursive method. Just to practice recursion too. |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |