课程: Level Up: Python

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Identify a palindrome

Identify a palindrome

(electronic blipping) - [Instructor] Identifying certain patterns within strings, or other types of data structures, is a common programming task. For this challenge, your goal is to write a Python function that determines if a given string is a palindrome. A palindrome is a word or phrase that reads the same forwards as it does backwards. For example, the word level is spelled the same forwards and backwards. And race car is a combination of two words, that's the same both ways, ignoring the space between them. Your function should accept a single input of the string to evaluate and return a Boolean value indicating whether or not that string was a palindrome. Your function should only consider letters A through Z when evaluating the string. And you should ignore their case, treating uppercase and lowercase letters as being the same. For example, if you call your function on the string hello world, it should…

内容