#!/usr/bin/env python my_input = 329 my_step = my_input current_position = 0 my_circular_list = [0] my_circular_list_len = 1 ##Comment below line for part 1 at_position_1 = None for i in range(1,50000001): ##Comment line above and ##uncomment below line for part 1 ###for i in range(1,2017): current_position = (current_position + my_step) % my_circular_list_len current_position += 1 ###Comment 2 lines below for part 1 if current_position == 1: at_position_1 = i my_circular_list_len += 1 ##Uncomment below line for part 1 ###my_circular_list.insert(current_position, i) ##Uncomment 2 lines below for part 1 ###answer1 = my_circular_list[current_position+1] ###print("Part 1: " + str(answer1)) ##Comment 2 lines below for part 1 answer2 = at_position_1 print("Part 2: " + str(answer2))