Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integers_list = []
- commands_list = []
- number = input().split()
- for element in number:
- if element.isdigit():
- integers_list.append(int(element))
- elif element.isalpha():
- commands_list.append(element)
- for command in commands_list:
- if command == "add":
- integers_list.append(101)
- elif command == "remove":
- integers_list.remove(3)
- elif command == "clear":
- integers_list.clear()
- elif command == "sort":
- integers_list.sort(reverse=True)
- else:
- continue
- integers_list2 = []
- for digit in integers_list:
- integers_list2.append(str(digit))
- print("-".join(integers_list2))
- data = input().split("-")
- num_list = []
- command_list = []
- final_list = []
- for element in data:
- if element.isdigit():
- num_list.append(int(element))
- elif element.isalpha():
- command_list.append(element)
- for command in command_list:
- if command == "A":
- num_list.append(11)
- elif command == "R":
- for zero in num_list:
- if zero % 10 == 0:
- num_list.remove(zero)
- break
- elif command == "L":
- print(len(num_list))
- elif command == "S":
- mid_of_list = len(num_list) // 2
- num_list.insert(mid_of_list, sum(num_list))
- elif command == "m":
- num_list.insert(0, min(num_list))
- elif command == "M":
- num_list.append(max(num_list))
- elif command == "s":
- num_list.sort()
- elif command == "r":
- num_list.reverse()
- elif command == "C":
- num_list.clear()
- elif command == "c":
- eleven_count = num_list.count(11)
- num_list.append(eleven_count)
- elif command == "E":
- int_list_copy = num_list.copy()
- num_list.extend(int_list_copy)
- elif command == "I":
- eleven_index = num_list.index(11)
- num_list.append(eleven_index)
- elif command == "i":
- num_list.insert(3, eleven_index)
- elif command == "P":
- num_list.pop()
- elif command == "p":
- print(num_list.pop(3))
- for digit in num_list:
- final_list.append(str(digit))
- print(":".join(final_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement