Guest User

Untitled

a guest
May 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. '''
  2. Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20, 25])
  3. and makes a new list of only the first and last elements of the given list.
  4. For practice, write this code inside a function.
  5. '''
  6.  
  7. lista = [5, 10, 15, 20, 25]
  8. listb = []
  9.  
  10. def firstlast():
  11. first = lista[0]
  12. last = lista[-1]
  13. return print(f'''
  14. primeiro item: {first}
  15. último item: {last}
  16. ''')
  17. firstlast()
Add Comment
Please, Sign In to add comment