Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data_num = list(map(int, input().split()))
- data = input()
- while not data == "END":
- command = data.split()
- if command[0] == "multiply":
- if command[1] == "list":
- data_num *= int(command[2])
- elif command[1].isdigit():
- if int(command[1]) in data_num:
- data_num = [num * int(command[2]) if num == int(command[2]) else num for num in data_num]
- else:
- pass
- else:
- break
- elif command[0] == "contains":
- if int(command[1]) in data_num:
- print("True")
- else:
- print("False")
- elif command[0] == "add":
- if command[1].isdigit():
- data_num.append(int(command[1]))
- else:
- list_num = list(map(int,command[1].split(",")))
- data_num.extend(list_num)
- data = input()
- data_num.sort()
- print(*data_num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement