def process_sheet(sheet): even_flag = True odd_flag = False for item in sheet: if item % 2 == 0: continue else: even_flag = False odd_flag = True break if even_flag: for i in range(len(sheet)): sheet[i] = sheet[i] / 2 elif odd_flag: for i in range(len(sheet)): sheet[i] = sheet[i] * 3 + 1 else: for i in range(len(sheet)): if sheet[i] % 2 == 0: sheet[i] = sheet[i] + 1 else: sheet[i] = sheet[i] - 1 return sheet