11:Check Primality Functions 檢查基本功能 <<
Previous 12:List Ends 清單結尾
Exercise 12 (and Solution) 練習12(和解決方案)
Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20, 25]) and makes a new list of only the first and last elements of the given list. For practice, write this code inside a function.
編寫一個程序,該程序接受一個數字列表(例如,a = [5、10、15、20、25]),並僅給出給定列表的第一個和最後一個元素組成一個新列表。 為了練習,請在函數內編寫此代碼。
Concepts to practice 練習概念
• Lists and properties of lists
列表和列表屬性
• List comprehensions (maybe)
列表理解(也許)
• Functions
職能
Happy coding! 祝您編碼愉快!
11:Check Primality Functions 檢查基本功能 <<
Previous