Created
February 7, 2019 23:24
-
-
Save pdbartsch/9d71fe31d23aa9f0b22307bed9c1dac6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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. | |
''' | |
import random | |
a = random.sample(range(1, 100), 15) | |
def listends(a): | |
print('',a,'\n',[a for a in [a[0], a[-1]]]) | |
listends(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment