aneliabogeva

Command Center

Aug 16th, 2019
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data_list = list(map(int,input().split()))
  2.  
  3. command = input().split()
  4. new_list = []
  5. counter = 0
  6.  
  7. while not command[0] == 'end':
  8. if command[0] == "swap":
  9. if int(command[1]) not in range (0, len(data_list)) or int(command[2]) not in range(0, len(data_list)):
  10. print(data_list)
  11. else:
  12. index1 = int(command[1])
  13. index2 = int(command[2])
  14. temp = data_list[index2]
  15. data_list[index2] = data_list[index1]
  16. data_list[index1] = temp
  17. print(data_list)
  18. counter += 1
  19. elif command[0] == 'enumerate_list':
  20. new_list_enum = list(enumerate(data_list, start=0))
  21. print(new_list_enum)
  22. counter += 1
  23. elif command[0] == 'max':
  24. print(max(data_list))
  25. counter += 1
  26. elif command[0] == 'min':
  27. print(min(data_list))
  28. counter += 1
  29. elif command[0] == "get_divisible":
  30. number_dev = int(command[2])
  31. new_list_dev = [item for item in data_list if item % number_dev == 0]
  32. print(new_list_dev)
  33. counter += 1
  34. command = input().split()
  35. print(counter)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×