初心者向けのPythonのプログラミング問題です。入門編としてチャレンジしてください。Pythonの正答例は以下になります。
問題403
def is_palindrome(string):
return string == string[::-1]
print(is_palindrome(“madam”)) # True
print(is_palindrome(“hello”)) # False
問題404
from functools import reduce
numbers = [1, 2, 3, 4]
product = reduce(lambda x, y: x * y, numbers)
print(product) # 24
問題405
string = “hello123”
print(any(char.isdigit() for char in string)) # True



コメント