初心者向けのPythonのプログラミング問題です。入門編としてチャレンジしてください。Pythonの正答例は以下になります。
問題397
def longest_word(string):
words = string.split()
return max(words, key=len)
print(longest_word(“I love programming in Python”)) # programming
問題398
numbers = [1, 2, 3, 4]
result = [x + 5 for x in numbers]
print(result) # [6, 7, 8, 9]
問題399
numbers = [5, 2, 7, 3]
min_index = numbers.index(min(numbers))
print(min_index) # 1



コメント