Round 1:
Round 2:
lst1 = [1, 2, 34, 2, 3, 2, 2, 1, 2, 2] import collections most_common = collections.Counter(lst1) max_occ_key = max(most_common, key=most_common.get) print(f'max_occ_key : {max_occ_key}')
from collections import deque lst = [1, 2, 3, 4, 5, 6, 7] n = 7 d = 2 d_list = deque(lst) d_list.rotate(-d) print(f'Rotated List Using deque : {d_list}') rotated_list = [lst[(i + d) % len(lst)] for i, x in enumerate(lst)] print(f'rotated_list using list comprehension :{rotated_list}')
This article is contributed by Praveen. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.