SHARE
TWEET

Untitled

a guest Feb 22nd, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def push_or_pop(alist):
  2.     new_list = []
  3.     for lists in alist:
  4.         if type(lists) == int:
  5.             if lists > 5:
  6.                 new_list.append(lists)
  7.  
  8.             elif lists <= 5:
  9.                 new_list.pop(-1)
  10.  
  11.             else:
  12.                 print("invalid number")
  13.     return new_list
  14.  
  15.  
  16. print(push_or_pop([12, 10, 4, 8, 3, 9]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top