Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def push_or_pop(alist):
- new_list = []
- for lists in alist:
- if type(lists) == int:
- if lists > 5:
- new_list.append(lists)
- elif lists <= 5:
- new_list.pop(-1)
- else:
- print("invalid number")
- return new_list
- print(push_or_pop([12, 10, 4, 8, 3, 9]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement