初心者向けのPythonのプログラミング問題です。入門編としてチャレンジしてください。Pythonの正答例は以下になります。
問題406
strings = [“hello”, “world”]
print(all(s.islower() for s in strings)) # True
問題407
def swap_first_last(lst):
lst[0], lst[-1] = lst[-1], lst[0]
return lst
numbers = [1, 2, 3, 4]
print(swap_first_last(numbers)) # [4, 2, 3, 1]
問題408
words = [“hello”, “world”]
uppercase_words = [word.upper() for word in words]
print(uppercase_words) # [‘HELLO’, ‘WORLD’]



コメント