Solution: HW03
testfuncscerrsol_stdoutsol_keptsol_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 494, 'const': 552, 'code+const': 1046}
def prize_check (lot,prize):
        t = 0
        for p in prize[:-1]:
            if lot == p:
                t += prize[-1]
        return t
def big_prizes (lot,prizes):
        t = 0
        for pz in prizes:
            t += prize_check(lot, pz)
        return t
def next_to_first (lot,prize):
        t = 0
        p = int(prize[0]) - 1
        p1 = 999999 if p < 0 else p
        p = int(prize[0]) + 1
        p2 = 0 if p > 999999 else p
        lot = int(lot)
        if lot == p1 or lot == p2:
            t = prize[-1]
        return t
def first_digits_check(lot,prize):
        t = 0
        for p in prize[:-1]:
            if lot[:len(p)] == p:
                t += prize[-1]
        return t
def last_digits_check(lot,prize):
        t = 0
        for p in prize[:-1]:
            if p == lot[-len(p):]:
                t += prize[-1]
        return t
def digit_prizes (lot,prizes):
        t = first_digits_check(lot, prizes[0])
        t += last_digits_check(lot, prizes[1])
        t += last_digits_check(lot, prizes[2])
        return t
def total_prize (lot,all_prizes):
        t = big_prizes(lot, all_prizes[:5])
        t += next_to_first(lot, all_prizes[5])
        t += digit_prizes(lot, all_prizes[6:])
        return t

Testsuite: HW03
from spj_grader_034 import *
import copy

class Testsuite(spjTestsuite):
    
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_prize_check_1(self):
        pz = ['111111', '456789', '012345', 0]
        for p in pz[:-1]:
            pz[-1] = int(p)
            self.keep(prize_check(p, list(pz)))
        self.keep(prize_check('999999', pz))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_prize_check_2(self):
        pz = ['111111', '012345', '111111', '012345', '012345', 1234]
        self.keep(prize_check('111111', pz))
        self.keep(prize_check('012345', pz))
        self.keep(prize_check('999999', pz))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_big_prizes_1(self):
        pzs = [['193840',113],
               ['211111', '211112', 97],
               ['311111', '311112', '311113', 71],
               ['411111', '411112', '411113', '411114', 67],
               ['511111', '511112', '511113', '511114', '511115', 59]]
        t = 0
        for pz in pzs:
            for p in pz[:-1]:
                t += big_prizes(p, copy.deepcopy(pzs))
        self.keep(t)
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_big_prizes_2(self):
        p = '217365'
        pzs = [[p,113],
               [p, p, 97],
               [p, p, p, 71],
               [p, p, p, p, 67],
               [p, p, p, p, p, 59]]
        self.keep(big_prizes(p, pzs))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_next_to_first_1(self):
        self.keep(next_to_first('123445', ['123445', 987]))
        self.keep(next_to_first('123439', ['123440', 987]))
        self.keep(next_to_first('123440', ['123439', 987]))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_next_to_first_2(self):
        self.keep(next_to_first('000001', ['000001', 987]))
        self.keep(next_to_first('000000', ['000001', 987]))
        self.keep(next_to_first('000002', ['000001', 987]))
        self.keep(next_to_first('999997', ['999998', 987]))
        self.keep(next_to_first('999999', ['999998', 987]))
        self.keep(next_to_first('999999', ['000000', 987]))
        self.keep(next_to_first('000000', ['999999', 987]))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_first_digits_check_1(self):
        self.keep(first_digits_check('011456', ['111', '456', 71]))
        self.keep(first_digits_check('111456', ['111', '456', 71]))
        self.keep(first_digits_check('456111', ['111', '456', 71]))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_first_digits_check_2(self):
        self.keep(first_digits_check('011456', ['111', '456', 71]))
        self.keep(first_digits_check('111456', ['111', '456', '111', 71]))
        self.keep(first_digits_check('456111', ['456', '111', '456', 71]))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_last_digits_check_1(self):
        self.keep(last_digits_check('111450', ['111', '456', 71]))
        self.keep(last_digits_check('111456', ['111', '456', '456', 71]))
        self.keep(last_digits_check('456111', ['111', '456', '111', 71]))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_last_digits_check_2(self):
        self.keep(last_digits_check('111450', ['56', 71]))
        self.keep(last_digits_check('111450', ['45', 71]))
        self.keep(last_digits_check('111456', ['56', 71]))

    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_digit_prizes_1(self):
        pzs = [['123', '456', 23], ['789', '345', 29], ['91', 53]]
        self.keep(digit_prizes('833374', pzs))
        self.keep(digit_prizes('123000', pzs))
        self.keep(digit_prizes('456000', pzs))
        self.keep(digit_prizes('000789', pzs))
        self.keep(digit_prizes('000345', pzs))
        self.keep(digit_prizes('000091', pzs))
    
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_digit_prizes_2(self):
        pzs = [['456', '456', 23], ['123', '123', 29], ['23', 53]]
        self.keep(digit_prizes('843374', pzs))
        self.keep(digit_prizes('123123', pzs))
        
    #------------------------------------------------------
    @spjTestsuite.testcase(spjTestsuite.score_exact_kept,
                           score_kwargs={'depth':0})
    def test_total_prize(self):
        pzs = [['555556', 6000001],
               ['111111', '222222', 200001],
               ['333333', '444444', '666666', 80001],
               ['555555', '555555', '777777', '888888', 40001],
               ['000001', '000002', '000003', '000004', '000005', '000006', 20001],
               ['555556', 100001],
               ['555', '666', 4001],
               ['777', '888', 3001],
               ['55', 2001]]
        self.keep(total_prize('555555', pzs))

        

6630007121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[111111, 456789, 12345, 0]
test_prize_check_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[2468, 3702, 0]
test_big_prizes_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[1083]
test_big_prizes_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[1083]
test_next_to_first_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 987, 987]
test_next_to_first_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 71, 71]
test_first_digits_check_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 142, 142]
test_last_digits_check_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 142, 142]
test_last_digits_check_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 0, 71]
test_digit_prizes_10.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[0, 111]
test_total_prize0.0 prizes_total = 0
^^^^^^^^^^^^
IndentationError: expected an indented block after function definition on line 73
[186005]
bytecount: {}
def prize_check (lot,prize):
    hit = 0
    for i in range(len(prize) - 1):
        if lot == prize[0]:
            hit = hit+1
    return prize[-1]*hit
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    prizes_total = 0
    for j in range(len(prizes)):
        hit = 0
        for i in range(len(prizes[j])-1):
            if lot == prizes[j][i]:
                hit = hit+1
        prizes_total += prizes[j][-1]*hit
    return prizes_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    total_prize = 0
    if prize[0] != '000000' and prize[0] != '999999':
        if int(lot) in [int(prize[0])-1, int(prize[0])+1]:
            total_prize += prize[-1]
    elif prize[0] == '000000':
        if int(lot) == int(prize[0])+1:
            total_prize += prize[-1]
    elif prize[0] == '999999':
        if int(lot) == int(prize[0])-1:
            total_prize += prize[-1]
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    hit = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
            hit = hit+1
    return prize[-1]*hit
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    total_prize = 0
    hit = 0
    for i in range(len(prize)-1):
        if lot[3:] == prize[i]:
            hit = hit+1
    total_prize += int(prize[-1])*hit
    hit = 0
    for i in range(len(prize)-1):
        if lot[4:] == prize[i]:
            hit = hit+1
    total_prize += int(prize[-1])*hit
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    prizes_total = 0
    prizes_total += first_digits_check(lot,prizes[0])
    prizes_total += last_digits_check(lot,prizes[1])
    prizes_total += last_digits_check(lot,prizes[2])
    return prizes_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    def total_prize (lot,all_prizes):
    prizes_total = 0
    prizes_total += big_prizes(lot,all_prizes[:5])
    prizes_total += next_to_first(lot,all_prizes[5])
    prizes_total += digit_prizes (lot,all_prizes[6:])
    return prizes_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630021921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0ModuleNotFoundError("No module named \'traitlets\'")
[111111, 456789, 12345, 0]
test_prize_check_20.0ModuleNotFoundError("No module named \'traitlets\'")
[2468, 3702, 0]
test_big_prizes_10.0ModuleNotFoundError("No module named \'traitlets\'")
[1083]
test_big_prizes_20.0ModuleNotFoundError("No module named \'traitlets\'")
[1083]
test_next_to_first_10.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 987, 987]
test_next_to_first_20.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 71, 71]
test_first_digits_check_20.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 142, 142]
test_last_digits_check_10.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 142, 142]
test_last_digits_check_20.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 0, 71]
test_digit_prizes_10.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0ModuleNotFoundError("No module named \'traitlets\'")
[0, 111]
test_total_prize0.0ModuleNotFoundError("No module named \'traitlets\'")
[186005]
bytecount: {'code': 610, 'const': 896, 'code+const': 1506}
from traitlets.config.application import LevelFormatter
def prize_check(lot,prize):
  reward = 0
  for e in prize[:-1]:
    if lot == e:
      reward += int(prize[-1])
  return reward
def big_prizes (lot,prizes):
  reward = 0
  for e in prizes :
    reward += prize_check(lot,e)
  return reward
def next_to_first (lot,prize):
  reward = 0
  near_one = []
  number,n = prize
  if number == "000000":
    near_one += ["999999","000001"]
  elif number == "999999":
    near_one +=["999998","000000"]
  else :
    near_one += [str(int(number)-1),str(int(number)+1)]
  for e in near_one:
    if lot == e:
      reward += int(prize[-1])
  return reward
def first_digits_check(lot,prize):
  reward = 0
  for e in prize[:-1]:
    if lot[:3] == e:
      reward += prize[-1]
  return reward
def last_digits_check(lot,prize):
  reward = 0
  for e in prize[:-1]:
    if len(e) == 3:
      if lot[3:] == e:
        reward += prize[-1]
    elif len(e) == 2:
      if lot[4:] == e:
        reward += prize[-1]
  return reward
def digit_prizes (lot,prizes):
  reward = 0
  for i in range(len(prizes)):
    if i == 0:
      reward += first_digits_check(lot,prizes[i])
    else :
      reward += last_digits_check(lot,prizes[i])
  return reward
def total_prize (lot,all_prizes):
  reward = 0
  reward += big_prizes(lot,all_prizes[:5])
  reward += next_to_first(lot,all_prizes[5])
  reward += digit_prizes(lot,all_prizes[6:])
  return reward

6630220421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[0111111, 0456789, 012345, 0]
test_prize_check_20.0
[02468, 3702, 0]
test_big_prizes_10.0
[1083]
test_big_prizes_20.0
[1083]
test_next_to_first_10.0
[0, 0987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 0987, 0987, 987, 987]
test_first_digits_check_10.0
[710, 71, 71]
test_first_digits_check_20.0
[710, 7142, 7142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 636, 'const': 964, 'code+const': 1600}
def prize_check (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        for i in range(len(prizes)-1):
            if lot == int(prizes[i]):
                price += prizes[-1]
        return price
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        for i in range(len(prizes)):
            price += prize_check(lot,prizes[i])
        return price
def next_to_first (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        price = 0
        for i in range(len(prizes)):
            int_prizes = int(prizes[i])
            int_prizes_add = int_prizes + 1
            int_prizes_sub = int_prizes - 1
            if prizes[i] == '000000':
                int_prizes_add = '000001'
                int_prizes_sub = '999999'
            if prizes[i] == '999999':
                int_prizes_add = '000000'
                int_prizes_sub = '999998'
            if str(lot) == int_prizes_add or lot == int_prizes_sub:
                price = prizes[-1]
        return price
def first_digits_check(lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        lot = str(lot)
        n = len(lot)
        for i in range(len(prizes)-1):
            if lot[n//2:] == prizes[i]:
                price += prizes[-1]
        return price
def last_digits_check(lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        price = 0
        lot = str(lot)
        n = len(lot)
        for i in range(len(prizes)-1):
            if lot[:n//2] == prizes[i]:
                price += prizes[-1]
            elif lot[:n//3] == prizes[i]:
                price += prizes[-1]
        return price
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        price += first_digits_check(lot,all_prizes[6])
        price += last_digits_check(lot,all_prizes[7])
        price += last_digits_check(lot,all_prizes[8])
        return price
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        price = 0
        price += big_prizes(lot,all_prizes[:5])
        price += next_to_first(lot,all_prizes[5])
        price += digit_prizes (lot,all_prizes[6:])
        return price

6631101621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[80000111111, 4567800009, 8000012345, 0]
test_prize_check_20.0
[02468, 3702, 0]
test_big_prizes_10.0
[6108000003]
test_big_prizes_20.0
[6108000003]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 100000987, 100000987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860005]
bytecount: {'code': 2178, 'const': 1752, 'code+const': 3930}
def prize_check (lot,prize):
    Sum = 0
    p = prize
    if len(p) == 2 :
        count = 0
        for a in p :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 6 * (10 ** 6)
    if len(p) == 3 :
        count = 0
        for a in p :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 5)
    if len(p) == 4 :
        count = 0
        for a in p :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 8 * (10 ** 4)
    if len(p) == 5 :
        count = 0
        for a in p :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 4 * (10 ** 4)
    if len(p) == 7 :
        count = 0
        for a in p :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 4)
    return(Sum)
def big_prizes (lot,prizes):
    Sum = 0
    for p in prizes :
        if len(p) == 2 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(p) == 3 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(p) == 4 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(p) == 5 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(p) == 7 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
    return(Sum)
def next_to_first (lot,prize):
    Sum = 0
    p= prize
    if len(p) == 2 :
        count = 0
        if int(p[0]) + 1 == int(lot) :
            count += 1
        if int(p[0]) - 1 == int(lot) :
            count += 1
        Sum += count * 1 * (10 ** 5)
    return(Sum)
def first_digits_check(lot,prize):
    Sum = 0
    p = prize
    if len(p) == 3 :
        if len(p[0]) and len(p[1]) == 3 :
            count = 0
            for a in p:
                if a == lot[0:3:1]:
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    return(Sum)
def last_digits_check(lot,prize):
    Sum = 0
    p = prize
    if len(p) == 3:
        if len(p[0]) and len(p[1]) == 3 :
            count = 0
            for a in p :
                if a == lot[3::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    if len(p) == 2 :
        if len(p[0]) == 2 :
            count = 0
            for a in p :
                if a == lot[4::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 3)
    return (Sum)
def digit_prizes (lot,prizes):
    Sum = 0
    for p in prizes:
        if len(p) == 3:
            if len(p[0]) and len(p[1]) == 3 :
                count = 0
                for a in p:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(p) == 2 :
            if len(p[0]) == 2 :
                count = 0
                for a in p :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)
def total_prize (lot,all_prizes):
    Sum = 0
    for p in all_prizes :
        if len(p) == 2 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(p) == 3:
            count = 0
            for a in p:
                if a == lot:
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(p) == 4 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(p) == 5 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(p) == 7 :
            count = 0
            for a in p :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
        if len(p) == 2 and len(p[0]) == 6 and p[1] == 6000000 :
            count = 0
            A = int(p[0]) + 1
            B = int(p[0]) - 1
            if A == int(lot) :
                count += 1
            if B == int(lot) :
                count += 1
            Sum += count * 1 * (10 ** 5)
        if len(p) == 3:
            if len(p[0]) and len(p[1]) == 3 :
                count = 0
                for a in p:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(p) == 2 :
            if len(p[0]) == 2 :
                count = 0
                for a in p :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)

6631104521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[80000111111, 4567800009, 8000012345, 0]
test_prize_check_20.0
[02468, 3702, 0]
test_big_prizes_10.0
[6108000003]
test_big_prizes_20.0
[6108000003]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 100000987, 100000987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860005]
bytecount: {'code': 2178, 'const': 1752, 'code+const': 3930}
def prize_check (lot,prize):
    Sum = 0
    c = prize
    if len(c) == 2 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 6 * (10 ** 6)
    if len(c) == 3 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 5)
    if len(c) == 4 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 8 * (10 ** 4)
    if len(c) == 5 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 4 * (10 ** 4)
    if len(c) == 7 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 4)
    return(Sum)
def big_prizes (lot,prizes):
    Sum = 0
    for c in prizes :
        if len(c) == 2 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(c) == 3 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(c) == 4 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(c) == 5 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(c) == 7 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
    return(Sum)
def next_to_first (lot,prize):
    Sum = 0
    c = prize
    if len(c) == 2 :
        count = 0
        if int(c[0]) + 1 == int(lot) :
            count += 1
        if int(c[0]) - 1 == int(lot) :
            count += 1
        Sum += count * 1 * (10 ** 5)
    return(Sum)
def first_digits_check(lot,prize):
    Sum = 0
    c = prize
    if len(c) == 3 :
        if len(c[0]) and len(c[1]) == 3 :
            count = 0
            for a in c:
                if a == lot[0:3:1]:
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    return(Sum)
def last_digits_check(lot,prize):
    Sum = 0
    c = prize
    if len(c) == 3:
        if len(c[0]) and len(c[1]) == 3 :
            count = 0
            for a in c :
                if a == lot[3::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    if len(c) == 2 :
        if len(c[0]) == 2 :
            count = 0
            for a in c :
                if a == lot[4::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 3)
    return (Sum)
def digit_prizes (lot,prizes):
    Sum = 0
    for c in prizes:
        if len(c) == 3:
            if len(c[0]) and len(c[1]) == 3 :
                count = 0
                for a in c:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(c) == 2 :
            if len(c[0]) == 2 :
                count = 0
                for a in c :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)
def total_prize (lot,all_prizes):
    Sum = 0
    for c in all_prizes :
        if len(c) == 2 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(c) == 3:
            count = 0
            for a in c:
                if a == lot:
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(c) == 4 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(c) == 5 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(c) == 7 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
        if len(c) == 2 and len(c[0]) == 6 and c[1] == 6000000 :
            count = 0
            A = int(c[0]) + 1
            B = int(c[0]) - 1
            if A == int(lot) :
                count += 1
            if B == int(lot) :
                count += 1
            Sum += count * 1 * (10 ** 5)
        if len(c) == 3:
            if len(c[0]) and len(c[1]) == 3 :
                count = 0
                for a in c:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(c) == 2 :
            if len(c[0]) == 2 :
                count = 0
                for a in c :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)

6631107421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[80000111111, 4567800009, 8000012345, 0]
test_prize_check_20.0
[02468, 3702, 0]
test_big_prizes_10.0
[6108000003]
test_big_prizes_20.0
[6108000003]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 100000987, 100000987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860005]
bytecount: {'code': 2178, 'const': 1752, 'code+const': 3930}
def prize_check (lot,prize):
    Sum = 0
    c = prize
    if len(c) == 2 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 6 * (10 ** 6)
    if len(c) == 3 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 5)
    if len(c) == 4 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 8 * (10 ** 4)
    if len(c) == 5 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 4 * (10 ** 4)
    if len(c) == 7 :
        count = 0
        for a in c :
            if a == lot :
                count += 1
            else :
                count += 0
        Sum += count * 2 * (10 ** 4)
    return(Sum)
def big_prizes (lot,prizes):
    Sum = 0
    for c in prizes :
        if len(c) == 2 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(c) == 3 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(c) == 4 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(c) == 5 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(c) == 7 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
    return(Sum)
def next_to_first (lot,prize):
    Sum = 0
    c = prize
    if len(c) == 2 :
        count = 0
        if int(c[0]) + 1 == int(lot) :
            count += 1
        if int(c[0]) - 1 == int(lot) :
            count += 1
        Sum += count * 1 * (10 ** 5)
    return(Sum)
def first_digits_check(lot,prize):
    Sum = 0
    c = prize
    if len(c) == 3 :
        if len(c[0]) and len(c[1]) == 3 :
            count = 0
            for a in c:
                if a == lot[0:3:1]:
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    return(Sum)
def last_digits_check(lot,prize):
    Sum = 0
    c = prize
    if len(c) == 3:
        if len(c[0]) and len(c[1]) == 3 :
            count = 0
            for a in c :
                if a == lot[3::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 4 * (10 ** 3)
    if len(c) == 2 :
        if len(c[0]) == 2 :
            count = 0
            for a in c :
                if a == lot[4::1] :
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 3)
    return (Sum)
def digit_prizes (lot,prizes):
    Sum = 0
    for c in prizes:
        if len(c) == 3:
            if len(c[0]) and len(c[1]) == 3 :
                count = 0
                for a in c:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(c) == 2 :
            if len(c[0]) == 2 :
                count = 0
                for a in c :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)
def total_prize (lot,all_prizes):
    Sum = 0
    for c in all_prizes :
        if len(c) == 2 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 6 * (10 ** 6)
        if len(c) == 3:
            count = 0
            for a in c:
                if a == lot:
                    count += 1
                else:
                    count += 0
            Sum += count * 2 * (10 ** 5)
        if len(c) == 4 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 8 * (10 ** 4)
        if len(c) == 5 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 4 * (10 ** 4)
        if len(c) == 7 :
            count = 0
            for a in c :
                if a == lot :
                    count += 1
                else :
                    count += 0
            Sum += count * 2 * (10 ** 4)
        if len(c) == 2 and len(c[0]) == 6 and c[1] == 6000000 :
            count = 0
            A = int(c[0]) + 1
            B = int(c[0]) - 1
            if A == int(lot) :
                count += 1
            if B == int(lot) :
                count += 1
            Sum += count * 1 * (10 ** 5)
        if len(c) == 3:
            if len(c[0]) and len(c[1]) == 3 :
                count = 0
                for a in c:
                    if a == lot[0:3:1] :
                        count += 1
                    elif a == lot[3::1] :
                        count += 1
                Sum += count * 4 * (10 ** 3)
        if len(c) == 2 :
            if len(c[0]) == 2 :
                count = 0
                for a in c :
                    if a == lot[4::1] :
                        count += 1
                    else:
                        count += 0
                Sum += count * 2 * (10 ** 3)
    return(Sum)

6631121121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0 s +=
^
SyntaxError: invalid syntax
[111111, 456789, 12345, 0]
test_prize_check_20.0 s +=
^
SyntaxError: invalid syntax
[2468, 3702, 0]
test_big_prizes_10.0 s +=
^
SyntaxError: invalid syntax
[1083]
test_big_prizes_20.0 s +=
^
SyntaxError: invalid syntax
[1083]
test_next_to_first_10.0 s +=
^
SyntaxError: invalid syntax
[0, 987, 987]
test_next_to_first_20.0 s +=
^
SyntaxError: invalid syntax
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0 s +=
^
SyntaxError: invalid syntax
[0, 71, 71]
test_first_digits_check_20.0 s +=
^
SyntaxError: invalid syntax
[0, 142, 142]
test_last_digits_check_10.0 s +=
^
SyntaxError: invalid syntax
[0, 142, 142]
test_last_digits_check_20.0 s +=
^
SyntaxError: invalid syntax
[0, 0, 71]
test_digit_prizes_10.0 s +=
^
SyntaxError: invalid syntax
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0 s +=
^
SyntaxError: invalid syntax
[0, 111]
test_total_prize0.0 s +=
^
SyntaxError: invalid syntax
[186005]
bytecount: {}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
 s = 0
 for num in prize[:-1]:
  if lot == num:
    s += int(prize[-1])
  return s
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
 s = 0
 for prize in prizes:
  s += prize_check (lot,prize)
  return s
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
 s = 0
 next_to = []
 first,p = prize
 if first == '000000':
  next_to += ['999999','000001']
 elif first == '999999':
    next_to += ['999998','000000']
 else:
      next_to += [str(int(first)-1), str(int(first)+1)]
 for num in next_to:
     if lot == num:
          s += p
          return s
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
 s = 0
 for num in prize[:-1]:
  if lot[:3] == num:
    s += prize[-1]
    return s
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
 s = 0
 for num in prize[:-1]:
  if len(num) == 3:
    if lot[-3:] == num:
      s += prize[-1]
    elif len(num) == 2:
      if lot[-2:] == num:
          s += prize[-1]
      else:
          pass
  return s
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
 s = 0
 for i in range(len(prizes)):
  if i == 0:
     s +=
  first_digits_check(lot,prizes[i])
 else:
  s +=
  last_digits_check(lot,prizes[i])
  return s
  def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
   s = 0
   s += big_prizes(lot,all_prizes[:5])
   s += next_to_first(lot,all_prizes[5])
   s += digit_prizes(lot,all_prizes[6:])
   return s

6631210321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0AttributeError("'list' object has no attribute 'items'")
[111111, 456789, 12345, 0]
test_prize_check_20.0AttributeError("'list' object has no attribute 'items'")
[2468, 3702, 0]
test_big_prizes_10.0AttributeError("'list' object has no attribute 'items'")
[1083]
test_big_prizes_20.0AttributeError("'list' object has no attribute 'items'")
[1083]
test_next_to_first_10.0AttributeError("'list' object has no attribute 'items'")
[0, 987, 987]
test_next_to_first_20.0AttributeError("'list' object has no attribute 'items'")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0AttributeError("'list' object has no attribute 'items'")
[0, 71, 71]
test_first_digits_check_20.0AttributeError("'list' object has no attribute 'items'")
[0, 142, 142]
test_last_digits_check_10.0AttributeError("'list' object has no attribute 'items'")
[0, 142, 142]
test_last_digits_check_20.0AttributeError("'list' object has no attribute 'items'")
[0, 0, 71]
test_digit_prizes_10.0AttributeError("'list' object has no attribute 'items'")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0AttributeError("'list' object has no attribute 'items'")
[0, 111]
test_total_prize0.0AttributeError("'list' object has no attribute 'items'")
[186005]
bytecount: {'code': 486, 'const': 419, 'code+const': 905}
def prize_check(ticket, prizes):
    total_prize = 0
    for prize, value in prizes.items():
        if ticket == prize:
            total_prize += value
    return total_prize
def big_prizes(ticket, all_prizes):
    big_prizes_list = {k: v for k, v in all_prizes.items() if k in ['111111', '222222', '333333', '444444', '555555']}
    return prize_check(ticket, big_prizes_list)
def next_to_first(ticket, all_prizes):
    next_to_first_list = {k: v for k, v in all_prizes.items() if k == '555556'}
    return prize_check(ticket, next_to_first_list)
def first_digits_check(ticket, all_prizes):
    first_digits_list = {k: v for k, v in all_prizes.items() if k.isdigit() and len(k) == 6}
    return prize_check(ticket, first_digits_list)
def last_digits_check(ticket, all_prizes):
    last_digits_list = {k: v for k, v in all_prizes.items() if k.isdigit() and (len(k) == 5 or len(k) == 4)}
    return prize_check(ticket, last_digits_list)
def digit_prizes(ticket, all_prizes):
    total_prize = 0
    total_prize += first_digits_check(ticket, all_prizes)
    total_prize += last_digits_check(ticket, all_prizes)
    return total_prize
def total_prize(ticket, all_prizes):
    total = 0
    total += big_prizes(ticket, all_prizes)
    total += next_to_first(ticket, all_prizes)
    total += digit_prizes(ticket, all_prizes)
    return total

6631451221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
['111111, 456789', 0, 012345, 0]
test_prize_check_20.0
['012345'68, 3702, 0]
test_big_prizes_10.0TypeError("unsupported operand type(s) for +=: 'int' and 'str'")
[1083]
test_big_prizes_20.0
['21708365']
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_10.0
[0, 071, 071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 023, 023, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 308, 'const': 364, 'code+const': 672}
def prize_check(lot,prize):
    total_prize = 0
    for a in prize:
        if lot == prize[0]:
            total_prize = prize[1]
    return total_prize
def big_prizes(lot,prizes):
    total_prize = 0
    for i in range(5):
        total_prize = prize_check(lot, prizes[i])
    return total_prize
def next_to_first(lot,prizes):
    return prize_check(lot,prizes)
def first_digits_check(lot,prizes):
    return prize_check(lot, prizes)
def last_digits_check(lot,prizes):
    return prize_check(lot,prizes)
def digit_prizes(lot,prizes):
    total_prize = 0
    for i in range(total_prize):
        total_prize = first_digits_check(lot, prizes[i])
        total_prize = last_digits_check(lot, prizes[i])
    total_prize = last_digits_check(lot, prizes[1])
    return total_prize
def total_prize(lot,prizes):
    total = 0
    total = big_prizes(lot, all_prizes)
    total = next_to_first(lot, all_prizes[5])
    total = digit_prizes(lot, all_prizes[6:])
    return total

6631454121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[691111113, 456789, 10370234, 592590, 0]
test_prize_check_20.0
[26049168, 263704912, 0]
test_big_prizes_10.0
[2319500283]
test_big_prizes_20.0
[326108823]
test_next_to_first_10.0
[0, 0987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 0987, 0987, 0987, 0987]
test_first_digits_check_10.0
[0, 63871, 071]
test_first_digits_check_20.0
[0, 71492, 10942]
test_last_digits_check_10.0
[0, 0142, 71492]
test_last_digits_check_20.0
[0, 0, 7127]
test_digit_prizes_10.0
[0, 6023, 023, 116329, 029, 14453]
test_digit_prizes_20.0
[0, 35111]
test_total_prize0.0
[21817776005]
bytecount: {'code': 652, 'const': 492, 'code+const': 1144}
def prize_check(lot, prize):
    prize = [int(p) for p in prize]
    return sum(prize) if int(lot) in prize else 0
def big_prizes(lot, prizes):
    total_winnings = 0
    for prize in prizes:
        prize = [int(p) for p in prize]
        total_winnings += sum(prize) if int(lot) in prize else 0
    return total_winnings
def next_to_first(lot, prize):
    prize = [int(p) for p in prize]
    if len(prize) > 1 and int(lot) == prize[1]:
        return sum(prize)
    else:
        return 0
def first_digits_check(lot, prize):
    prize = [int(p) for p in prize]
    return sum(prize) if int(lot[:3]) == prize[0] else 0
def last_digits_check(lot, prize):
    prize = [int(p) for p in prize]
    return sum(prize) if int(lot[-3:]) == prize[0] or int(lot[-2:]) == prize[0] else 0
def digit_prizes(lot, prizes):
    total_winnings = 0
    for prize in prizes:
        prize = [int(p) for p in prize]
        if int(lot[:3]) == prize[0] or int(lot[-3:]) == prize[0] or int(lot[-2:]) == prize[0]:
            total_winnings += sum(prize)
    return total_winnings
def total_prize(lot, all_prizes):
    total_winnings = 0
    for prizes in all_prizes:
        prizes = [int(p) for p in prizes]
        total_winnings += sum(prizes) if int(lot) in prizes else 0
    return total_winnings

6631463821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0 for a in prizes
^
SyntaxError: expected ':'
[111111, 456789, 12345, 0]
test_prize_check_20.0 for a in prizes
^
SyntaxError: expected ':'
[2468, 3702, 0]
test_big_prizes_10.0 for a in prizes
^
SyntaxError: expected ':'
[1083]
test_big_prizes_20.0 for a in prizes
^
SyntaxError: expected ':'
[1083]
test_next_to_first_10.0 for a in prizes
^
SyntaxError: expected ':'
[0, 987, 987]
test_next_to_first_20.0 for a in prizes
^
SyntaxError: expected ':'
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0 for a in prizes
^
SyntaxError: expected ':'
[0, 71, 71]
test_first_digits_check_20.0 for a in prizes
^
SyntaxError: expected ':'
[0, 142, 142]
test_last_digits_check_10.0 for a in prizes
^
SyntaxError: expected ':'
[0, 142, 142]
test_last_digits_check_20.0 for a in prizes
^
SyntaxError: expected ':'
[0, 0, 71]
test_digit_prizes_10.0 for a in prizes
^
SyntaxError: expected ':'
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0 for a in prizes
^
SyntaxError: expected ':'
[0, 111]
test_total_prize0.0 for a in prizes
^
SyntaxError: expected ':'
[186005]
bytecount: {}
from traitlets.traitlets import List
def prize_check (lot,prize):
  prizevalue = prize[-1]
  prizenumber = prize[:len(prize)-1:1]
  for a in prizenumber:
    if lot == a:
       sum = sum + prizevalue
  return sum
  #Allprize = [555556,6000000],[555555,555557,100000],[111111,222222,200000],[333333,444444,666666,80000],[555555,555555,777777,888888,40000],[000001,000002,000003,000004,000005,000006,20000],[555,666,4000],[55,2000]
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  for a in prizes
      print(a)
      if lot == a:
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    pass
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    pass
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    pass
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    pass
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    pass

6631541021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'prize_check' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'prize_check' is not defined")
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'big_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'big_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'next_to_first' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'next_to_first' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'first_digits_check' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'first_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'last_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'last_digits_check' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'digit_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'digit_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'total_prize' is not defined")
[186005]
bytecount: {'code': 4, 'const': 16, 'code+const': 20}

6631542721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0Illegal imports: ['os']
[111111, 456789, 12345, 0]
test_prize_check_20.0Illegal imports: ['os']
[2468, 3702, 0]
test_big_prizes_10.0Illegal imports: ['os']
[1083]
test_big_prizes_20.0Illegal imports: ['os']
[1083]
test_next_to_first_10.0Illegal imports: ['os']
[0, 987, 987]
test_next_to_first_20.0Illegal imports: ['os']
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0Illegal imports: ['os']
[0, 71, 71]
test_first_digits_check_20.0Illegal imports: ['os']
[0, 142, 142]
test_last_digits_check_10.0Illegal imports: ['os']
[0, 142, 142]
test_last_digits_check_20.0Illegal imports: ['os']
[0, 0, 71]
test_digit_prizes_10.0Illegal imports: ['os']
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0Illegal imports: ['os']
[0, 111]
test_total_prize0.0Illegal imports: ['os']
[186005]
bytecount: {'code': 602, 'const': 730, 'code+const': 1332}
from os import execle
def prize_check (lot,prize) :
  sum =0
  for i in prize :
    if lot == i   :
      sum += prize[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  sum = 0
  for i in range(len(prizes)) :
      sum += prize_check (lot,prizes[i])
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  sum = 0
  for i in prize :
   if lot == "999999" :
    closeprize = ["999999",prize[-1]]
   if lot == "000000" :
    closeprize = ["000000",prize[-1]]
   else :
    closeprize = [str(int(prize[0])-1),str(int(prize[0])+1),prize[-1]]
  return prize_check (lot,closeprize)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  sum = 0
  x = lot[:3]
  return prize_check (x,prize)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize) :
  sum = 0
  three = len(lot) - len(prize[0])
  y = lot[three:6]
  return prize_check (y,prize)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes) :
  m = 0
  for i in range(len(prizes)) :
    if i == 0 :
        m += first_digits_check(lot,prizes[i])
    else :
        m += last_digits_check(lot,prizes[i])
  return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  sum_money = 0
  for i in all_prizes :
    if i in all_prizes[:5] :
      sum_money += prize_check (lot,i)
    elif i == all_prizes[5] :
      sum_money += next_to_first (lot,i)
    elif  i == all_prizes[6] : #7,8,9
      sum_money += first_digits_check(lot,i)
    elif  i == all_prizes[7] : #7,8,9
      sum_money += last_digits_check(lot,i)
    elif  i == all_prizes[8] : #7,8,9
      sum_money += last_digits_check(lot,i)
  return sum_money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631703421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'prize_check' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'prize_check' is not defined")
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'big_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'big_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'next_to_first' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'next_to_first' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'first_digits_check' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'first_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'last_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'last_digits_check' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'digit_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'digit_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'total_prize' is not defined")
[186005]
bytecount: {'code': 4, 'const': 16, 'code+const': 20}

6632253521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'prize_check' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'prize_check' is not defined")
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'big_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'big_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'next_to_first' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'next_to_first' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'first_digits_check' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'first_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'last_digits_check' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'last_digits_check' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'digit_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'digit_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'total_prize' is not defined")
[186005]
bytecount: {'code': 4, 'const': 16, 'code+const': 20}

6630046621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'all_prizes' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'all_prizes' is not defined")
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1394, 'const': 1858, 'code+const': 3252}
def prize_check (lot,prize):
    total = 0
    for i in range(len(prize)-1):
        if lot in all_prizes[len(prize)-2][i]:
            total += int(all_prizes[len(prize)-2][-1])
        else :
            total += 0
    return total
def big_prizes (lot,prizes):
    total = 0
    for e in range(5):
        for i in range(len(all_prizes[e])-1):
            if lot in all_prizes[e][i]:
                total += int(all_prizes[e][-1])
            else :
                total += 0
    return total
def next_to_first (lot,prize):
    x = str(int(all_prizes[5][0])-1)
    y = str(int(all_prizes[5][0])+1)
    x = x.zfill(6)
    y = y.zfill(6)
    if x == '-00001' :
        x = '999999'
    if y == '1000000' :
        y = '000000'
    if lot == x or lot == y :
        return all_prizes[5][-1]
    if not lot == x or lot == y :
        return 0
def first_digits_check(lot,prize):
    total = 0
    for i in range(2):
        if lot[0:3:1] in all_prizes[6][i]:
            total += int(all_prizes[6][-1])
        else :
            total += 0
    return total
def last_digits_check(lot,prize):
    total = 0
    if len(prize[0]) == 3 :
        for i in range(2):
            if lot[3:6:1] in all_prizes[7][i]:
                total += int(all_prizes[7][-1])
            else :
                total += 0
    if len(prize[0]) == 2 :
        for i in range(1):
            if lot[4:6:1] in all_prizes[8][i]:
                total += int(all_prizes[8][-1])
            else :
                total += 0
    return total
def digit_prizes (lot,prizes):
    total = 0
    for e in range(3):
        if e == 0 :
            for i in range(2):
                if lot[0:3:1] in all_prizes[6][i]:
                    total += int(all_prizes[6][-1])
                else :
                    total += 0
        if e == 1 :
            for i in range(2):
                if lot[3:6:1] in all_prizes[7][i]:
                    total += int(all_prizes[7][-1])
                else :
                    total += 0
        if e == 2 :
            for i in range(1):
                if lot[4:6:1] in all_prizes[8][i]:
                    total += int(all_prizes[8][-1])
                else :
                    total += 0
    return total
def total_prize (lot,all_prizes):
    total = 0
    for e in range(5):
        for i in range(len(all_prizes[e])-1):
            if lot in all_prizes[e][i]:
                total += int(all_prizes[e][-1])
            else :
                total += 0
    x = str(int(all_prizes[5][0])-1)
    y = str(int(all_prizes[5][0])+1)
    x = x.zfill(6)
    y = y.zfill(6)
    if x == '-00001' :
        x = '999999'
    if y == '1000000' :
        y = '000000'
    if lot == x or lot == y :
        total += all_prizes[5][-1]
    if not lot == x or lot == y :
        total += 0
    for e in range(3):
        if e == 0 :
            for i in range(2):
                if lot[0:3:1] in all_prizes[6][i]:
                    total += int(all_prizes[6][-1])
                else :
                    total += 0
        if e == 1 :
            for i in range(2):
                if lot[3:6:1] in all_prizes[7][i]:
                    total += int(all_prizes[7][-1])
                else :
                    total += 0
        if e == 2 :
            for i in range(1):
                if lot[4:6:1] in all_prizes[8][i]:
                    total += int(all_prizes[8][-1])
                else :
                    total += 0
    return total

6331518421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'big_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'big_prizes' is not defined")
[1083]
test_next_to_first_10.0
[100000, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0NameError("name 'big_prizes' is not defined")
[186005]
bytecount: {'code': 430, 'const': 680, 'code+const': 1110}
def prize_check (lot,prize):
    m = 0
    for e in prize[:-1]:
      if e == lot:
        m = m + prize[-1]
    return m
def next_to_first (lot,prize):
    m = 0
    if lot == int(prize[0])+1 or int(prize[0])-1:
      m = 100000
    return m
def first_digits_check(lot,prize):
    m = 0
    for e in prize:
      if e == lot[0:3:1]:
        m = m + 4000
    return m
def last_digits_check(lot,prize):
    m = 0
    for e in prize:
      if e == lot[3::]:
        m = m + 4000
    for e in prize:
      if e == lot[4::]:
        m = m + 2000
    return m
def digit_prizes (lot,prizes):
    m = 0
    for e in prizes[0]:
      if e == lot[0:3:1]:
        m = m + 4000
    for e in prizes[1]:
      if e == lot[3::]:
        m = m + 4000
    for e in prizes[2]:
      if e == lot[4::]:
        m = m + 2000
    return m
def total_prize (lot,all_prizes):
    m = big_prizes(lot,all_prizes) + next_to_first(lot,all_prizes) + digit_prizes(lot,all_prizes)
    return m

6630230721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[0111111, 0456789, 012345, 0]
test_prize_check_20.0
[02468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, None987, None987, 987, 987, None987, None987]
test_first_digits_check_10.0
[0, 071, 071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[None0, None23, None23, None29, None29, None53]
test_digit_prizes_20.0
[None0, None111]
test_total_prize0.0
[None186005]
bytecount: {'code': 360, 'const': 504, 'code+const': 864}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  Checkprice = 0
  firstprice = prize[-1]
  for lots in range(len(prize) - 1):
    if (lot == lots):
      Checkprice += firstprice
  return Checkprice
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  bigprizes = 0
  for prize in range(len(prizes)):
    for lots in range(len(prizes[prize])):
      if lot == prizes[prize][lots]:
        bigprizes += prizes[prize][-1]
  return bigprizes
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  if lot in [str(int(prize[0])+1), str(int(prize[0])-1)]:
    return prize[-1]
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  first_digits = lot[3]
  return prize_check(first_digits, prize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  last_two = lot[4]
  last_three = lot[3]
  last_cheak = 0
  last_cheak += prize_check(last_two, prize)
  last_cheak += prize_check(last_three, prize)
  return last_cheak
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  first_three = lot[3]
  last_two = lot[4]
  last_three = lot[3]
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  pass

6631128621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'all_prizes' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'all_prizes' is not defined")
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 520, 'const': 660, 'code+const': 1180}
def prize_check (lot,prize):
    money = 0
    if all_prizes.index(prize) < 5 :
        for i in prize:
            if lot == i:
                money += prize[-1]
    return money
def big_prizes (lot,prize):
    money = 0
    for i in prize:
        for e in range(0, len(i)):
            if lot == i[e]:
                money += i[-1]
    return money
def next_to_first (lot,prize):
    money = 0
    if all_prizes.index(prize) == 5 :
        if int(lot) == int(prize[0]) + 1 or int(prize[0]) - 1 :
            money += prize[-1]
    return money
def first_digits_check(lot,prize):
    money = 0
    if all_prizes.index(prize) == 6 :
        for i in prize:
            if lot[0:3] == i:
                money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    if all_prizes.index(prize) > 6 :
        for i in prize:
            if lot[3:] == i or lot[4:] == i :
                money += prize[-1]
    return money
def digit_prizes (lot,prize):
    money = 0
    for i in prize:
        money += first_digits_check(lot,i)
        money += last_digits_check(lot,i)
    return money
def total_prize (lot,all_prizes):
    money = 0
    for i in all_prizes:
        money += prize_check(lot,i)
        money += next_to_first(lot,i)
        money += first_digits_check(lot,i)
        money += last_digits_check(lot,i)
    return money

6631138921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[111111, 0456789, 012345, 0]
test_prize_check_20.0
[123468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860025]
bytecount: {'code': 514, 'const': 720, 'code+const': 1234}
def prize_check(lot, prize):
    total_prize_check = 0
    for i in range (len(prize)):
        if lot == prize[i]:
            total_prize_check +=  prize[-1]
        else:
            return total_prize_check
def big_prizes(lot, prizes):
    total_prize_big = 0
    for prize_list in prizes:
        for i in range(len(prize_list)):
            if prize_list[i] == lot:
                total_prize_big +=prize_list[-1]
    return total_prize_big
def next_to_first(lot, prize):
    total_prize_next_to_first = 0
    for p in prize:
        if p == str(int(lot) - 1) or p == str(int(lot) + 1):
            total_prize_next_to_first += 100000
    return total_prize_next_to_first
def first_digits_check(lot, prize):
    total_prize_first_digits = 0
    for p in prize:
        if p == lot[:3]:
            total_prize_first_digits += 4000
    return total_prize_first_digits
def last_digits_check(lot, prize):
    total_prize_last_digits = 0
    for p in prize:
        if isinstance(p, str):
            if len(p) == 2 and p == lot[-2:]:
                total_prize_last_digits += 2000
            elif len(p) == 3 and p == lot[-3:]:
                total_prize_last_digits += 4000
    return total_prize_last_digits
def digit_prizes(lot, prizes):
    total_prize_digits = 0
    total_prize_digits += first_digits_check(lot, prizes[0])
    total_prize_digits += last_digits_check(lot, prizes[1])
    total_prize_digits += last_digits_check(lot, prizes[2])
    return total_prize_digits
def total_prize(lot, all_prizes):
    return  big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6631507821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'all_prizes' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'all_prizes' is not defined")
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 674, 'const': 660, 'code+const': 1334}
def prize_check (lot,prize):
    price = 0
    if all_prizes.index(prize) < 5:
        for i in prize[:-1]:
            if int(lot) == int(i):
                price += int(prize[-1])
    return price
def big_prizes (lot,prize):
    price = 0
    for e in prize:
        for i in e[:-1]:
            if int(lot) == int(i):
                price += int(e[-1])
    return price
def next_to_first (lot,prize):
    price = 0
    if all_prizes.index(prize) >= 5:
        if int(lot) == int(prize[0])+1:
            price += int(prize[-1])
        if int(lot) == int(prize[0])-1:
            price += int(prize[-1])
    return price
def first_digits_check(lot,prize):
    price = 0
    if all_prizes.index(prize) < 7:
        lot3f = lot[0:3]
        for i in prize[:-1]:
            if int(lot3f) == int(i):
                price += int(prize[-1])
    return price
def last_digits_check(lot,prize):
    price = 0
    if all_prizes.index(prize) >= 7:
        lot3b = lot[3:]
        lot2b = lot[4:]
        for i in prize[:-1]:
            if int(lot3b) == int(i):
                price += int(prize[-1])
            if int(lot2b) == int(i):
                price += int(prize[-1])
    return price
def digit_prizes (lot,prize):
    digit_price = 0
    for i in prize:
        first_digits = first_digits_check(lot,i)
        last_digits = last_digits_check(lot,i)
        digit_price += first_digits
        digit_price += last_digits
    return digit_price
def total_prize (lot,all_prizes):
    all_price = 0
    for i in all_prizes:
        price1to5 = prize_check (lot,i)
        pricenextnum = next_to_first (lot,i)
        first_digits = first_digits_check(lot,i)
        last_digits = last_digits_check(lot,i)
        all_price += price1to5
        all_price += pricenextnum
        all_price += first_digits
        all_price += last_digits
    return all_price

6631547921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'all_prizes' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'all_prizes' is not defined")
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 664, 'const': 716, 'code+const': 1380}
def prize_check (lot,prize):
    p = 0
    if all_prizes.index(prize) < 5:
        for i in prize[:-1]:
            if int(lot) == int(i):
                p += int(prize[-1])
    return p
def big_prizes (lot,prize):
    p = 0
    for e in prize:
        for i in e[:-1]:
            if int(lot) == int(i):
                p += int(e[-1])
    return p
def next_to_first (lot,prize):
    p = 0
    if all_prizes.index(prize) >= 5:
        if int(lot) == int(prize[0])+1:
            p += int(prize[-1])
        if int(lot) == int(prize[0])-1:
            p += int(prize[-1])
    return p
def first_digits_check(lot,prize):
    p = 0
    if all_prizes.index(prize) < 7:
        lot3f = lot[0:3]
        for i in prize[:-1]:
            if int(lot3f) == int(i):
                p += int(prize[-1])
    return p
def last_digits_check(lot,prize):
    p = 0
    if all_prizes.index(prize) >= 7:
        lot3b = lot[3:]
        lot2b = lot[4:]
        for i in prize[:-1]:
            if int(lot3b) == int(i):
                p += int(prize[-1])
            if int(lot2b) == int(i):
                p += int(prize[-1])
    return p
def digit_prizes (lot,prize):
    dp = 0
    for i in prize:
        first_digits = first_digits_check(lot,i)
        last_digits = last_digits_check(lot,i)
        dp += first_digits
        dp += last_digits
    return dp
def total_prize (lot,all_prizes):
    ap = 0
    price1to5 = big_prizes(lot,all_prizes[:5])
    pricenextnum = next_to_first(lot,all_prizes[5])
    pricedigits = digit_prizes (lot,all_prizes[6:])
    ap += price1to5
    ap += pricenextnum
    ap += pricedigits
    return ap

6331512621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860025]
bytecount: {'code': 810, 'const': 1000, 'code+const': 1810}
def prize_check(lot,prize):
    m = 0
    k = 0
    while k < len(prize)-1:
        if lot == prize[0:-1:1][k]:
            m += prize[-1]
        k += 1
    return m
def big_prizes(lot,prizes):
    m = 0
    for i in range(5):
        k = 0
        while k < len(prizes[i])-1:
            if lot == prizes[i][0:-1:1][k]:
                m += prizes[i][-1]
            k += 1
    return m
def next_to_first(lot,prize):
    m = 0
    x1 = int(lot) + 1
    x2 = int(lot) - 1
    i = 0
    for i in range(len(prize)-1):
        if str(x1) == (prize[0:-1:1][i]):
            m += 100000
        if str(x2) == (prize[0:-1:1][i]):
            m += 100000
    return m
def first_digits_check(lot,prize):
    m = 0
    for i in range(len(prize)-1):
        if lot[0:3:1] == prize[0:-1:1][i]:
            m += 4000
    return m
def last_digits_check(lot,prize):
    m = 0
    for i in range(len(prize)-1):
        if lot[4::1] == prize[0:-1:1][i]:
            m += 2000
    for i in range(len(prize)-1):
        if lot[3::1] == prize[0:-1:1][i]:
            m += 4000
    return m
def digit_prizes(lot,prizes):
    m = 0
    k = 0
    while k < len(prizes)-1:
        if lot[0:3:1] == prizes[0][k]:
            m += 4000
        if lot[3::1] == prizes[1][k]:
            m += 4000
        k += 1
    if lot[4::1] == prizes[2][0]:
        m += 2000
    return m
def total_prize(lot,all_prizes):
    b = big_prizes (lot,all_prizes)
    c = next_to_first (lot,all_prizes[5])
    f = digit_prizes(lot,all_prizes[6:])
    m = b + c  + f
    return m

6530427021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 100000987, 100000987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860025]
bytecount: {'code': 460, 'const': 604, 'code+const': 1064}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    reward = 0
    for i in prize:
        if lot == i:
            reward += prize[-1]
    return reward
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    reward = 0
    for i in range(len(prizes)):
        reward += prize_check (lot,prizes[i])
    return reward
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    reward = 0
    lots = int(lot)
    for i in prize:
        if abs(lots - int(i)) == 1 or abs(lots - int(i)) == 999999:
            reward += 100000
    return reward
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    reward = 0
    for i in prize:
        if lot[0:3] == i:
            reward += 4000
    return reward
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    reward = 0
    for i in prize:
        if lot[-3:] == i:
            reward += 4000
        if lot[-2:] == i:
            reward += 2000
    return reward
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    y=0
    x = first_digits_check(lot,prizes[0])
    for i in range(1,len(prizes)):
        y += last_digits_check(lot,prizes[i])
    z = x+y
    return z
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    x = big_prizes (lot,all_prizes)
    y = next_to_first (lot,all_prizes[0])
    z = digit_prizes (lot,all_prizes)
    reward = x+y+z
    return reward

6532069321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 29, 29, 053]
test_digit_prizes_20.0
[0, 29111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 576, 'const': 856, 'code+const': 1432}
def prize_check(lot,price):
    reward=price[-1]
    correct=price[:-1]
    money=0
    for e in correct :
        if lot== e:
            money+=reward
    return money
def big_prizes(lot,prizes):
    money=0
    for i in range(len(prizes)) :
        money+=(prize_check(lot,all_prizes[i]))
    return money
def next_to_first(lot,prize):
    first=int(prize[0])
    reward=0
    if first in [000000,999999] :
        if first == 000000 :
            lucky=['999999','000001']
        else :
            lucky=['999998','000000']
    else :
        lucky=[str(first+1),str(first-1)]
    if lot in lucky :
        reward+=prize[1]
    return reward
def first_digits_check(lot,prize):
    money=0
    lot=lot[:3] ;  reward=prize[-1]
    if lot in prize[:-1] :
        money+=reward
    return money
def last_digits_check(lot,prize):
    money=0
    if len(prize[0])==2 :
        lot=lot[:2] ;  reward=prize[-1]
        if lot in prize[:-1] :
            money+=reward
    elif len(prize[0])==3 :
        lot=lot[3:] ;  reward=prize[-1]
        if lot in prize[:-1] :
            money+=reward
    return money
def digit_prizes(lot,prize):
    first_dit=first_digits_check(lot,prize[0])
    last_dit=last_digits_check(lot,prize[1])+last_digits_check(lot,prize[2])
    total=first_dit+last_dit
    return total
def total_prize(lot,all_prizes):
    big_check=big_prizes(lot,all_prizes[:5])
    next_first=next_to_first(lot,all_prizes[5])
    digit=digit_prizes (lot,all_prizes[6:])
    return big_check+next_first+digit

6630026021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'all_prizes' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'all_prizes' is not defined")
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 1816, 'const': 1626, 'code+const': 3442}
def prize_check (lot,prize):
    a=[]
    x=all_prizes.index(prize)
    for e in range(len(prize)):
        count=0
        if count<len(prize):
            if x<int(all_prizes.index(prize))+1:
                for f in range(len(prize)):
                    if count<len(prize):
                        if lot==((prize[f])):a.append(int((prize[-1])))
                        elif int(lot)==prize[-1]:a.append('0')
                        else:a.append('0')
                        count+=1
                x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def big_prizes (lot,prizes):
    a=[]
    x=0
    for e in range(len(prizes)):
        count=0
        if count<len(prizes[e]):
            if x<=4:
                for f in range(len(prizes[x])):
                    if count<len(prizes[x]):
                        if lot==((prizes[e][f])):a.append(int((prizes[e])[-1]))
                        elif int(lot)==(prizes[e])[-1]:a.append('0')
                        else:a.append('0')
                        count+=1
                x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def next_to_first (lot,prize):
    if lot=='999999':lot=['999998','000000']
    elif lot=='000000':lot=['999999','000001']
    elif lot=='000001':lot=['000000','000002']
    else:
        lot=lot.replace('0','')
        lot=int(lot)
        lot=['0'*(6-len(str(lot+1)))+str(lot+1),'0'*(6-len(str(lot-1)))+str(lot-1)]
    a=[]
    x=all_prizes.index(prize)
    for j in range(len(lot)):
        for e in range(len(prize)):
            count=0
            if count<len(prize):
                if x<int(all_prizes.index(prize))+1:
                    for f in range(len(prize)):
                        if count<len(prize):
                            if lot[j]==((prize[f])):a.append(int((prize[-1])))
                            elif int(lot[j])==prize[-1]:a.append('0')
                            else:a.append('0')
                            count+=1
                    x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def first_digits_check(lot,prize):
    a=[]
    x=all_prizes.index(prize)
    for e in range(len(prize)):
        count=0
        if count<len(prize):
            if x<int(all_prizes.index(prize))+1:
                for f in range(len(prize)):
                    if count<len(prize):
                        if lot[:3]==((prize[f])):a.append(int((prize[-1])))
                        elif int(lot[:3])==prize[-1]:a.append('0')
                        else:a.append('0')
                        count+=1
                x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def last_digits_check(lot,prize):
    a=[]
    x=all_prizes.index(prize)
    if x==7:lot=lot[3:]
    elif x==8:lot=lot[4:]
    for e in range(len(prize)):
        count=0
        if count<len(prize):
            if x<int(all_prizes.index(prize))+1:
                for f in range(len(prize)):
                    if count<len(prize):
                        if lot==((prize[f])):a.append(int((prize[-1])))
                        elif int(lot)==prize[-1]:a.append('0')
                        else:a.append('0')
                        count+=1
                x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def digit_prizes (lot,prizes):
    a=[]
    x=6
    for e in range(len(prizes)):
        count=0
        if count<len(prizes[e]):
            if x<=8:
                j=8-x
                if j==2:z=lot[:3]
                elif j==1:z=lot[3:]
                elif j==0:z=lot[4:]
                for f in range(len(prizes[x-6])):
                    if count<len(prizes[x-6]):
                        if z==((prizes[e][f])):a.append(int((prizes[e])[-1]))
                        elif int(z)==(prizes[e])[-1]:a.append('0')
                        else:a.append('0')
                        count+=1
                x+=1
    ans=0
    for i in range(len(a)):
        ans=int(a[i])+ans
    return ans
def total_prize (lot,all_prizes):
    x=big_prizes (lot,all_prizes[:5])
    y=next_to_first (lot,all_prizes[5])
    z=digit_prizes (lot,all_prizes[6:])
    return x+y+z

6630092421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 604, 'const': 968, 'code+const': 1572}
def prize_check (lot,prize):
    cash = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            cash += prize[-1]
    return cash
def big_prizes (lot,prizes):
    cash = 0
    for i in range (len(prizes)):
        for e in range(len(prizes[i])-1):
            if lot == prizes[i][e]:
                cash += prizes[i][-1]
    return cash
def next_to_first (lot,prize):
    cash = 0
    lot_1 = str(int(lot)-1)
    lot_2 = str(int(lot)+1)
    if lot_1 == all_prizes[5][0] or lot_2 == all_prizes[5][0]:
        cash += all_prizes[5][-1]
    return cash
def first_digits_check(lot,prize):
    cash = 0
    if lot[:3] in all_prizes[6]:
        cash += all_prizes[6][-1]
    return cash
def last_digits_check(lot,prize):
    cash = 0
    if lot[-3:] in all_prizes[7]:
        cash += all_prizes[7][-1]
    if lot[-2:] in all_prizes[8]:
        cash += all_prizes[8][-1]
    return cash
def digit_prizes (lot,prizes):
    cash = 0
    if lot[:3] in all_prizes[6]:
        cash += all_prizes[6][-1]
    if lot[-3:] in all_prizes[7]:
        cash += all_prizes[7][-1]
    if lot[-2:] in all_prizes[8]:
        cash += all_prizes[8][-1]
    return cash
def total_prize (lot,all_prizes):
    cash = 0
    cash += big_prizes(lot,all_prizes[:5])
    cash += next_to_first(lot,all_prizes[5])
    cash += digit_prizes (lot,all_prizes[6:])
    return cash

6631102221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 100000987, 100000987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860025]
bytecount: {'code': 530, 'const': 884, 'code+const': 1414}
def prize_check(lot, prize):
    total_prize = 0
    for p in prize[:len(prize)-1]:
        if lot == p:
            total_prize += prize[-1]
    return total_prize
def big_prizes(lot, prizes):
    total_prize = 0
    for p in prizes:
        for j in p:
            if lot == j:
                total_prize += p[-1]
    return total_prize
def next_to_first(lot, prize):
    total_prize = 0
    if lot == str(int(prize[0])+1000001)[-6::] or lot == str(int(prize[0]) + 999999)[-6::] :
        total_prize += 100000
    return total_prize
def first_digits_check(lot, prize):
    total_prize = 0
    for p in prize:
        if lot[0:3] == p:
            total_prize += 4000
    return total_prize
def last_digits_check(lot, prize):
    total_prize = 0
    for p in prize:
        if lot[-3:] == p:
            total_prize += 4000
        elif lot[-2:] == p :
            total_prize += 2000
    return total_prize
def digit_prizes(lot, prizes):
    total_prize = 0
    for pr in prizes:
        for p in pr[:len(pr)-1] :
            if lot[0:3] == p:
                total_prize += 4000
            elif lot[-3:] == p:
                total_prize += 4000
            elif lot[-2:] == p :
                total_prize += 2000
    return total_prize
def total_prize (lot,all_prizes):
    return big_prizes (lot,all_prizes[0:5]) +             next_to_first (lot,all_prizes[5]) +             digit_prizes (lot,all_prizes[6:])

6631215521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0UnboundLocalError("local variable 'win' referenced before assignment")
[111111, 456789, 12345, 0]
test_prize_check_20.0UnboundLocalError("local variable 'win' referenced before assignment")
[2468, 3702, 0]
test_big_prizes_10.0UnboundLocalError("local variable 'win' referenced before assignment")
[1083]
test_big_prizes_20.0UnboundLocalError("local variable 'win' referenced before assignment")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_10.0UnboundLocalError("local variable 'win' referenced before assignment")
[0, 71, 71]
test_first_digits_check_20.0UnboundLocalError("local variable 'win' referenced before assignment")
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0UnboundLocalError("local variable 'win' referenced before assignment")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0UnboundLocalError("local variable 'win' referenced before assignment")
[186005]
bytecount: {'code': 656, 'const': 492, 'code+const': 1148}
def prize_check (lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      win=x
    for  y in prize:
      if type(y)==str:
        if y==lot:
            money+=win
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  subwin=0
  for x in prizes:
    subwin+=prize_check(lot,x)
  return subwin
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      win=x
  for  y in prize:
    if type(y)==str:
          if int(y)+1==int(lot):
                money+=win
          elif int(y)-1==int(lot):
                money+=win
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      win=x
    for  y in prize:
        if type(y)==str:
            if y==lot[0:3:1]:
                money+=win
            elif int(y)==int(lot):
                money+=win
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      win=x
  for  y in prize:
    if type(y)==str:
        if y==lot[-len(y):]:
          money+=win
        elif int(y)==int(lot):
          money+=win
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  money=0
  money+=first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  money=0
  money+=big_prizes (lot,all_prizes[0:5])+digit_prizes (lot,all_prizes[6:])+next_to_first(lot,all_prizes[5])
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631807021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 684, 'const': 748, 'code+const': 1432}
def prize_check (lot,prize):
    mk= []
    for k in prize[0:-1]: #prizes = all_prizes[0]=['555556', 6000000]
        if lot == k:
            mk.append(prize[-1])
    return sum(mk)
def big_prizes(lot, prizes):
    n = 0
    for l in range(len(prizes)): #แต่ละรางวัล
        for v in prizes[l][0:-1]: # หาเลขรางวัลในลิสต์ ยกเว้นตัวสุดท้ายซึ่งคือเงินรางวัล
            if int(lot) == int(v): #ถ้าเลขไหนตรง
                n = n + int(prizes[l][-1]) #เอาตัวสุดท้ายซึ่งคือรางวัลในลิสตย่อยนั้นมาเพิ่ม
    return n
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if int(lot) == int(all_prizes[5][0]) - 1 :
        return int(all_prizes[5][-1])
    elif int(lot) == int(all_prizes[5][0]) + 1:
        return int(all_prizes[5][-1])
    else :
        return 0
    #ถูกแล้ว รางวัลข้างเคียง
def first_digits_check (lot,prize):
    t=0
    n=int(lot[0:3])
    if n== int(all_prizes[6][0]):
        t=t+int(all_prizes[6][2])
    elif n== int(all_prizes[6][1]):
        t=t+int(all_prizes[6][2])
    return t
#correcะ
def last_digits_check (lot,prize):
    p=0 #totalmoney
    _qqq=int(lot[3: ]) #last3
    _qq=int(lot[4: ]) #last2
    if _qqq==int(all_prizes[7][0]):
        p=p+int(all_prizes[7][2])
    elif _qqq==int(all_prizes[7][1]):
        p=p+int(all_prizes[7][2])
    elif _qq==int(all_prizes[8][0]):
        p=p+int(all_prizes[8][1])
    return int(p)
#correct
def digit_prizes (lot,prizes):
    result3first=first_digits_check(lot,prizes)
    result32last=last_digits_check(lot,prizes)
    totaldigit= result3first + result32last
    return totaldigit
def total_prize (lot,all_prizes):
    A=big_prizes(lot,all_prizes[0:5])
    B=next_to_first (lot,all_prizes[5])
    C=digit_prizes (lot,all_prizes[6:])
    return A+B+C

6632146021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[9870, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 6000111]
test_total_prize0.0
[1860035]
bytecount: {'code': 486, 'const': 688, 'code+const': 1174}
def prize_check(lot,prize):
    w=0
    for i in prize:
        if lot == i:
            w=w+prize[-1]
    return(w)
def big_prizes(lot,prizes):
    w=0
    for i in prizes:
        w=w+prize_check(lot,i)
    return(w)
def next_to_first(lot,prize):
    for i in prize:
        if lot== ((int(prize[0]))-1) or ((int(prize[0]))+1):
            w = prize[1]
    return(w)
def first_digits_check(lot,prize):
    w=0
    for i in prize:
        if lot[:3] == i:
            w=w+4000
    return(w)
def last_digits_check(lot,prize):
    w=0
    for i in prize:
        if lot[-2:] ==i:
            w=w+2000
        elif lot[-3:] ==i:
            w=w+4000
    return(w)
def digit_prizes(lot,prizes):
    w=0
    for i in prizes:
        for f in i:
            if lot[:3] == f:
                w=w+4000
                break
            if lot[-2:] == f:
                w=w+2000
                break
            elif lot[-3:] == f:
                w=w+4000
                break
    return(w)
def total_prize(lot,all_prizes):
    w=0
    for i in all_prizes:
        w=w+prize_check(lot,i)
    w=w+next_to_first(lot,all_prizes[5])
    w=w+digit_prizes(lot,all_prizes)
    return(w)

6631536021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 578, 'const': 886, 'code+const': 1464}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for a in range(5):
        money += prize_check(lot,all_prizes[a])
    return money
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    money = 0
    lower = int(prize[0]) - 1
    higher = int(prize[0]) + 1
    if lower < 0:
        lower = '999999'
    elif higher >= 1000000:
        higher = '000000'
    lower = str(lower)
    higher = str(higher)
    if lot == lower or lot == higher:
        money += prize[1]
    return money
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for b in range(len(prize)-1):
        if lot[:3] == prize[b]:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    money = 0
    if all_prizes.index(prize) == 7:
        for d in range(len(prize)-1):
            if lot[3:6] == prize[d]:
                money += prize[-1]
        return money
    else:
        for c in range(len(prize)-1):
            if lot[4:6] == prize[c]:
                money += prize[-1]
        return money
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    money = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
    return money
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    money = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
    return money

6531001421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 694, 'const': 804, 'code+const': 1498}
def prize_check (lot,prize):
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
  # คืนผลรวมของเงินรางวัลที่ได้
  sum = 0
  for i in range(len(prize)-1):
    if lot == prize[i]:
      sum = sum + int(prize[-1])
  return(sum)
def big_prizes (lot,prizes):
  value = 0
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
  # คืนผลรวมของเงินรางวัลที่ได้
  for i in range(len(prizes)):
    value = value + prize_check(lot,all_prizes[i])
  return(value)
def next_to_first (lot,prize):
  pocket = 0
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
  # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  if int(all_prizes[5][0]) + 1 == int(lot) or int(all_prizes[5][0]) - 1 == int(lot):
    pocket = pocket + prize[-1]
  if int(all_prizes[5][0]) == 0 and int(lot) == 999999:
    pocket = pocket + prize[-1]
  if int(all_prizes[5][0]) == 999999 and int(lot) == 0:
    pocket = pocket + prize[-1]
  return(pocket)
def first_digits_check(lot,prize):
  v = 0
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
  # คืนผลรวมของเงินรางวัลที่ได้
  for i in (range(len(prize)-1)):
    if lot[:3] == prize[i]:
      v = v + prize[-1]
  return(v)
def last_digits_check(lot,prize):
  s = 0
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
  # คืนผลรวมของเงินรางวัลที่ได้
  # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  for i in (range(len(prize)-1)):
    if len(prize[i]) == 3:
      if lot[3:6] == prize[i]:
        s = s + prize[-1]
    if len(prize[i]) == 2:
      if lot[4:6] == prize[i]:
        s = s + prize[-1]
  return(s)
def digit_prizes (lot,prizes):
  t = 0
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  # คืนผลรวมของเงินรางวัลที่ได้
  for i in range(len(prizes)):
    if prizes[i] == all_prizes[6]:
      t = t + first_digits_check(lot,all_prizes[6])
    if prizes[i] == all_prizes[7]:
      t = t + last_digits_check(lot,all_prizes[7])
    if prizes[i] == all_prizes[8]:
      t = t + last_digits_check(lot,all_prizes[8])
  return(t)
def total_prize (lot,all_prizes):
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
  # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  return(big_prizes(lot,all_prizes) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes))

6630055221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 868, 'const': 992, 'code+const': 1860}
def prize_check (lot,prize):
    ans =0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            ans += prize[len(prize)-1]
    return ans
def big_prizes(lot,prizes):
    ans =0
    for i in range(len(prizes)):
        for x in range(len(prizes[i])-1):
            if lot == prizes[i][x]:
                ans += prizes[i][len(prizes[i])-1]
    return ans
def next_to_first(lot,a):
    prize =[]
    ans =0
    if a[0] != '000000' and a[0] != '999999':
        close1= int(a[0]) +1
        close2= int(a[0]) -1
    elif a[0] == '000000':
        close1 = '999999'
        close2 = '000001'
    elif a[0] == '999999':
        close1 = '000000'
        close2 = '999998'
    prize.append( str(close1))
    prize.append( str(close2))
    prize.append(int(100000))
    for i in range(len(prize)-1):
        if lot == prize[i]:
            ans+= prize[len(prize)-1]
    return ans
def first_digits_check(lot,prize):
    ans = 0
    for i in range(len(prize)-1):
        if lot[0:3] == prize[i]:
            ans += prize[len(prize)-1]
            # print(ans)
    return ans
def last_digits_check(lot,prize):
    ans =0
    if prize == all_prizes[7]:
        for i in range(len(prize)-1):
            if lot[3:6] == prize[i]:
                ans += prize[len(prize)-1]
    elif prize == all_prizes[8]:
        for i in range(len(prize)):
            if lot[4:6] == prize[i]:
                ans += prize[len(prize)-1]
    return ans
def digit_prizes (lot,prizes):
    ans =0
    for i in range(len(prizes)):
        if prizes[i] == all_prizes[6]:
            ans += first_digits_check(lot,prizes[i])
        elif prizes[i] == all_prizes[7]:
            ans += last_digits_check(lot,prizes[i])
        elif prizes[i] == all_prizes[8]:
            ans += last_digits_check(lot,prizes[i])
    return ans
def total_prize (lot,all_prizes):
    ans = 0
    ans += big_prizes(lot,all_prizes[:5])
    ans += next_to_first(lot,all_prizes[5])
    ans += digit_prizes(lot,all_prizes[6:])
    return ans

6630098221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[9870, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 570, 'const': 772, 'code+const': 1342}
def prize_check (lot,prize):
  if lot in prize:
    x = prize[-1]
  else:
    x = 0
  y = x*prize.count(lot)
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  y=0
  for i in range(len(prizes)):
      if lot in prizes[i]:
          x = prizes[i][-1]
          y += x*(prizes[i].count(lot))
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  n = int(lot)
  n1 = str(n-1)
  n2 = str(n+1)
  if n1 or n2 in prize:
    x = prize[-1]
  else:
    x = 0
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  lot = lot[:3]
  if lot in prize:
    x = prize[-1]
  else:
    x = 0
  y = x*prize.count(lot)
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  x=0
  if prize == all_prizes[8] :
    lot = lot[4:]
    if lot in prize:
      x = prize[-1]
  if prize == all_prizes[7] :
    lot = lot[3:]
    if lot in prize:
      x = prize[-1]
  y = x*prize.count(lot)
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes(lot,prizes):
    m=0
    m+=first_digits_check(lot,prizes[0])
    m+=last_digits_check(lot,prizes[1])
    m+=last_digits_check(lot,prizes[2])
    return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  m=0
  m+=big_prizes(lot,all_prizes[0:5])
  m+=next_to_first(lot,all_prizes[5])
  m+=first_digits_check(lot,all_prizes[6])
  m+=last_digits_check(lot,all_prizes[7])
  m+=last_digits_check(lot,all_prizes[8])
  return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630174221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[6761083]
test_big_prizes_20.0
[6761083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize1.0
[186005]
bytecount: {'code': 652, 'const': 720, 'code+const': 1372}
def prize_check (lot,prize):
    num_pri = len(prize)
    ini_money = 0
    for i in prize[:num_pri-1]:
        if lot == i:
                money = prize[-1]
                ini_money = ini_money+money
        else:
                money = 0
                ini_money = ini_money+money
    return ini_money
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    ini_money = 0
    for prize in prizes:
        for i in prize[:-2]:
            if lot == i:
                money = prize[-1]
                ini_money = ini_money+money
            else:
                money = 0
                ini_money = ini_money+money
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    return ini_money
def next_to_first (lot,prize):
    next_first =[str(int(prize[0])-1), str(int(prize[0])+1)]
    for i in next_first:
        if lot == i:
            money = prize[-1]
            break
        else:
            money = 0
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    return money
def first_digits_check(lot,prize):
    ini_money = 0
    num_pri = len(prize)
    for i in prize[:num_pri-1]:
        if lot[:3] == i:
            money = prize[-1]
            ini_money = ini_money+money
        else:
            money = 0
            ini_money=ini_money+money
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    return ini_money
def last_digits_check(lot,prize):
    ini_money = 0
    if len(prize) > 2:
        num_pri = len(prize)
        for i in prize[:num_pri-1]:
            if lot[:3] == i:
                money = prize[-1]
                ini_money = ini_money+money
            else:
                money = 0
                ini_money=ini_money+money
    else:
        if lot[:2] == prize[0]:
            money = prize[-1]
            ini_money = ini_money+money
        else:
            money = 0
            ini_money=ini_money+money
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    return ini_money
def digit_prizes (lot,prizes):
    ini_money = first_digits_check(lot,prizes[0])
    for prize in prizes[1:]:
        ini_money = ini_money+last_digits_check(lot,prize)
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    return ini_money
def total_prize (lot,all_prizes):
    all_ini_money = big_prizes(lot,all_prizes[:5]) #เช็ครางวัลใหญ่
    all_ini_money = all_ini_money + next_to_first(lot,all_prizes[5]) #เช็ครางวัลข้างเคียง
    all_ini_money = all_ini_money + digit_prizes (lot,all_prizes[6:]) #เช็ครางวัล 3 หน้า,หลัง และ 2 หลัง
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    return all_ini_money

6630303921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[6761083]
test_big_prizes_20.0
[6761083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize1.0
[186005]
bytecount: {'code': 652, 'const': 720, 'code+const': 1372}
def prize_check(lot, prize):
    num_prizes = len(prize)
    accumulated_prize = 0
    for i in prize[:num_prizes - 1]:
        if lot == i:
            current_prize = prize[-1]
            accumulated_prize += current_prize
        else:
            current_prize = 0
            accumulated_prize += current_prize
    return accumulated_prize
def big_prizes(lot, prizes):
    accumulated_prize = 0
    for prize in prizes:
        for i in prize[:-2]:
            if lot == i:
                current_prize = prize[-1]
                accumulated_prize += current_prize
            else:
                current_prize = 0
                accumulated_prize += current_prize
    return accumulated_prize
def next_to_first(lot, prize):
    first_prize_range = [str(int(prize[0]) - 1), str(int(prize[0]) + 1)]
    for i in first_prize_range:
        if lot == i:
            current_prize = prize[-1]
            break
        else:
            current_prize = 0
    return current_prize
def first_digits_check(lot, prize):
    num_prizes = len(prize)
    accumulated_prize = 0
    for i in prize[:num_prizes - 1]:
        if lot[:3] == i:
            current_prize = prize[-1]
            accumulated_prize += current_prize
        else:
            current_prize = 0
            accumulated_prize += current_prize
    return accumulated_prize
def last_digits_check(lot, prize):
    accumulated_prize = 0
    if len(prize) > 2:
        num_prizes = len(prize)
        for i in prize[:num_prizes - 1]:
            if lot[:3] == i:
                current_prize = prize[-1]
                accumulated_prize += current_prize
            else:
                current_prize = 0
                accumulated_prize += current_prize
    else:
        if lot[:2] == prize[0]:
            current_prize = prize[-1]
            accumulated_prize += current_prize
        else:
            current_prize = 0
            accumulated_prize += current_prize
    return accumulated_prize
def digit_prizes(lot, prizes):
    accumulated_prize = first_digits_check(lot, prizes[0])
    for prize in prizes[1:]:
        accumulated_prize += last_digits_check(lot, prize)
    return accumulated_prize
def total_prize(lot, all_prizes):
    total_prize_amount = big_prizes(lot, all_prizes[:5])
    total_prize_amount += next_to_first(lot, all_prizes[5])
    total_prize_amount += digit_prizes(lot, all_prizes[6:])
    return total_prize_amount

6631207521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0, 0987, 0987, 0987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize0.0NameError("name 'next_to_frist' is not defined")
[186005]
bytecount: {'code': 622, 'const': 769, 'code+const': 1391}
def prize_check (lot,prize):
        # ฟังก์ชันตรวจรางวัลที่ 1-5 ทีละตัว
  y = 0
  for d in range(len(prize)):
    if lot == prize[d]:
      y += prize[-1]
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
        # ฟังก์ชันตรวจรางวัลที่ 1-5 ทุกตัว
  y = 0
  for d in range(len(prizes)):
    k = 0
    while k < len(prizes[d]):
      if lot == prizes[d][k]:
        y += prizes[d][-1]
      k += 1
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        # ฟังก์ชันตรวจรางวัลข้างเคียงรางวัลที่ 1
  y = 0
  for d in range(len(prize)):
      if lot == prize[d]:
          y +=prize[-1]
  if prize[0] == '000000':
      y = 0
      if lot == "000001" or "999999":
          y += int(prize[-1])
      else:
          y = 0
  if prize[0] == '999999':
      y = 0
      if lot == "000000" or "999998":
          y += int(prize[-1])
      else:
          y = 0
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
        # ฟังก์ชันตรวจรางวัลสลากเลขหน้า 3 ตัว
  y = 0
  first_digits = lot[:3]
  for i in range(len(prize)):
    if first_digits == prize[i]:
      y += prize[-1]
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        # ฟังก์ชันตรวจรางวัลเลขท้าย 3 ตัว และ 2 ตัว
  y = 0
  for d in prize:
      if lot[-1:-4:-1] == d or lot[-1:-3:-1] == d:
        y += int(prize[-1])
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
        # ฟังก์ชันตรวจรางวัลเลขท้าย 3 ตัว เลขท้าย 3 ตัว และ 2 ตัว
  y = 0
  for d in range(len(prizes)):
    if d == 0:
      y += first_digits_check(lot,prizes[d])
    else:
      y += first_digits_check(lot,prizes[d])
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        # ฟังก์ชันตรวจรางวัล
  y = 0
  y += big_prizes(lot,all_prizes[:5]) + next_to_frist(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
  return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631216121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0, 0987]
test_first_digits_check_10.0
[0, 71, 071]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 023, 29, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 500, 'const': 710, 'code+const': 1210}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        s = 0
        for i in prize[:-1]:
            win = True
            for v in range(6):
                #print(i)
                if i[v] != "X" and i[v] != lot[v]:
                    win = False
            if win:
                s += prize[-1]
        return s
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        s = 0
        for i in range(len(prizes)):
            v = prizes[i]
            if i == 4 and lot[-1] == prizes[i][-1]:
                s += prizes[i][-1]
            else:
                s += prize_check(lot,prizes[i])
        return s
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if lot[:-1] == prize[0][:-1]:
            return prize[-1]
        return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        if lot[:3] == prize[0][:3]:
            return prize[-1]
        return 0
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        #print(lot[-(len(prize[0])):],len(prize[0]))
        if lot[-(len(prize[0])):] == prize[0][-(len(prize[0])):]:
            return prize[-1]
        return 0
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6631452921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[6761083]
test_big_prizes_20.0
[6761083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize1.0
[186005]
bytecount: {'code': 650, 'const': 720, 'code+const': 1370}
def prize_check (lot,prize):
        x = len(prize)
        a = 0
        for i in prize[:x-1]:
                if lot == i:
                        p = prize[-1]
                        a = a + p
                else:
                        p = 0
                        a = a + p
        return a
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
        a = 0
        for prize in prizes:
                for i in prize[:-2]:
                    if lot == i:
                           b = prize[-1]
                           a = a + b
                    else:
                           b = 0
                           a = a + b
        return a
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        first =[str(int(prize[0])-1), str(int(prize[0])+1)]
        for i in first:
            if lot == i:
                np = prize[-1]
                break
            else:
                np = 0
        return np
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
        a = 0
        x = len(prize)
        for i in prize[:x-1]:
            if lot[:3] == i:
                b = prize[-1]
                a = a + b
        else:
            b = 0
            a = a+b
        return a
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        a = 0
        if len(prize) > 2:
            x = len(prize)
            for i in prize[:x-1]:
                if lot[:3] == i:
                    b = prize[-1]
                    a = a + b
                else:
                    b = 0
                    a = a + b
        else:
            if lot[:2] == prize[0]:
                b = prize[-1]
                a = a +b
            else:
                b = 0
                a = a+b
        return a
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
        a = first_digits_check(lot,prizes[0])
        for prize in prizes[1:]:
            a = a+last_digits_check(lot,prize)
        return a
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        all = big_prizes(lot,all_prizes[:5])
        all = all + next_to_first(lot,all_prizes[5])
        all = all + digit_prizes (lot,all_prizes[6:])
        return all
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631508421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[6910000083]
test_big_prizes_20.0
[6910000083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 8000142, 8000142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_10.0
[0, 400023, 400023, 400029, 400029, 200053]
test_digit_prizes_20.0
[0, 1000011]
test_total_prize0.0
[1860005]
bytecount: {'code': 2278, 'const': 2290, 'code+const': 4568}
def prize_check (lot,prize):
    prizes = prize[:-1]
    prizes1 = list(prizes)
    lot_list = list(map(str,lot.split(",")))
    reward = 0
    for num in prizes1:
        for nu in lot_list:
            if num == nu:
                reward += 1
    total_prize = reward * prize[-1]
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    lot_list = list(map(str,lot.split(",")))
    one = prizes[0]
    ones = one[:-1]
    reward1 = 0
    for num in ones:
        for nu in lot_list:
            if num == nu:
                reward1 += 6000000
    two = prizes[1]
    twos = two[:-1]
    reward2 = 0
    for num in twos:
        for nu in lot_list:
            if num == nu:
                reward2 += 200000
    three = prizes[2]
    threes = three[:-1]
    reward3 = 0
    for num in threes:
        for nu in lot_list:
            if num == nu:
                reward3 += 80000
    four = prizes[3]
    fours = four[:-1]
    reward4 = 0
    for num in fours:
        for nu in lot_list:
            if num == nu:
                reward4 += 40000
    five = prizes[4]
    fives = five[:-1]
    reward5 = 0
    for num in fives:
        for nu in lot_list:
            if num == nu:
                reward5 += 20000
    total_prize = (reward1 + reward2 + reward3 + reward4 + reward5)
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    prizes = prize[:-1]
    prizes1 = list(prizes)
    prizes2 = [int(item) for item in prizes1]
    lot_list = list(map(int,lot.split(",")))
    lot_lists = [int(item) for item in lot_list]
    reward = 0
    for num in prizes2:
        for nu in lot_lists:
            if num - 1 == nu or num + 1 == nu or abs(num - nu) == 999999:
                reward += 1
    total_prize = reward * prize[-1]
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    prizes = prize[:-1]
    prizes1 = list(prizes)
    prizes2 = [item[:3] for item in prizes1]
    lot_list = list(map(str,lot.split(",")))
    lot_lists = [item[:3] for item in lot_list]
    reward = 0
    for num in prizes2:
        for nu in lot_lists:
            if num == nu:
                reward += 1
    total_prize = reward * prize[-1]
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    prizes = prize[:-1]
    prizes1 = list(prizes)
    lot_list = list(map(str,lot.split(",")))
    lot_lists = [item[3:] for item in lot_list]
    reward1 = 0
    for num in prizes1:
        for nu in lot_lists:
            if num == nu:
                reward1 += 4000
    prizes1 = list(prizes)
    lot_listss = [item[-2:] for item in lot_list]
    reward2 = 0
    for num in prizes1:
        for nu in lot_listss:
            if num == nu:
                reward2 += 2000
    total_prize = (reward1 + reward2)
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    lot_list = list(map(str,lot.split(",")))
    lot_lists = [item[:3] for item in lot_list]
    one = prizes[-3]
    ones = one[:-1]
    reward1 = 0
    for num in ones:
        for nu in lot_lists:
            if num == nu:
                reward1 += 4000
    two = prizes[-2]
    twos = two[:-1]
    lot_listss = [item[3:] for item in lot_list]
    reward2 = 0
    for num in twos:
        for nu in lot_listss:
            if num == nu:
                reward2 += 4000
    three = prizes[-1]
    threes = three[:-1]
    lot_listsss = [item[-2:] for item in lot_list]
    reward3 = 0
    for num in threes:
        for nu in lot_listsss:
            if num == nu:
                reward3 += 2000
    total_prize = (reward1 + reward2 + reward3)
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    lot_list = list(map(str,lot.split(",")))
    one = all_prizes[0]
    ones = one[:-1]
    reward1 = 0
    for num in ones:
        for nu in lot_list:
            if num == nu:
                reward1 += 6000000
    two = all_prizes[1]
    twos = two[:-1]
    reward2 = 0
    for num in twos:
        for nu in lot_list:
            if num == nu:
                reward2 += 200000
    three = all_prizes[2]
    threes = three[:-1]
    reward3 = 0
    for num in threes:
        for nu in lot_list:
            if num == nu:
                reward3 += 80000
    four = all_prizes[3]
    fours = four[:-1]
    reward4 = 0
    for num in fours:
        for nu in lot_list:
            if num == nu:
                reward4 += 40000
    five = all_prizes[4]
    fives = five[:-1]
    reward5 = 0
    for num in fives:
        for nu in lot_list:
            if num == nu:
                reward5 += 20000
    six = all_prizes[5]
    sixs = six[:-1]
    sixss = list(sixs)
    sixsss = [int(item) for item in sixss]
    lot_list = list(map(int,lot.split(",")))
    lot_lists = [int(item) for item in lot_list]
    reward6 = 0
    for num in sixsss:
        for nu in lot_lists:
            if num - 1 == nu or num + 1 == nu:
                reward6 += 100000
    lot_list = list(map(str,lot.split(",")))
    lot_lists = [item[:3] for item in lot_list]
    seven = all_prizes[-3]
    sevens = seven[:6]
    reward7 = 0
    for num in sevens:
        for nu in lot_lists:
            if num == nu:
                reward7 += 4000
    eight = all_prizes[7]
    eights = eight[:-1]
    lot_listss = [item[3:] for item in lot_list]
    reward8 = 0
    for num in eights:
        for nu in lot_listss:
            if num == nu:
                reward8 += 4000
    nine = all_prizes[8]
    nines = nine[:-1]
    lot_listsss = [item[-2:] for item in lot_list]
    reward9 = 0
    for num in nines:
        for nu in lot_listsss:
            if num == nu:
                reward9 += 2000
    total_prize = (reward1 + reward2 + reward3 + reward4 + reward5 + reward6 + reward7 + reward8 + reward9)
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631534721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize0.0
[1860045]
bytecount: {'code': 344, 'const': 551, 'code+const': 895}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    return prize[-1] * prize[:-1].count(lot)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    return sum(prize_check(lot, prize) for prize in prizes)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if lot == '555555':
       return 100000
    return prize_check(lot, prize)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    if lot[:3] in prize[:-1]:
       return prize[-1]
    return 0
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    if lot[-2:] in prize[:-1]:
       return prize[-1]
    return 0
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
     return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6631537621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'prize' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'prize' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0NameError("name 'prize' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'prize' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'prize' is not defined")
[186005]
bytecount: {'code': 636, 'const': 912, 'code+const': 1548}
def prize_check(lot,prize):
    total_reward = 0
    for item in prize:
      if isinstance(item, str) and item == lot:
        total_reward += int(prize[-1])
    return total_reward
def big_prizes(lot,prizes):
    total_reward = 0
    for reward in prize:
      for item in reward:
        if isinstance(item, str) and item == lot:
          total_reward += int(reward[-1])
    return total_reward
def next_to_first(lot,prize):
    total_reward = 0
    for item in prize:
      if isinstance(item, str):
        if (lot == '999999') and ((item == '999998') or (item == '000000')):
          total_reward += int(prize[-1])
        elif (lot == '000000') and ((item == '999999') or (item == '000001')):
          total_reward += int(prize[-1])
        elif (int(lot) == int(item) + 1) or (int(lot) == int(item) - 1):
          total_reward += int(prize[-1])
    return total_reward
def first_digits_check(lot,prize):
    total_reward = 0
    for item in prize:
      if isinstance(item, str) and lot[0:3] == item:
        total_reward += int(prize[-1])
    return total_reward
def last_digits_check(lot,prize):
    total_reward = 0
    for item in prize:
      if isinstance(item, str) and (lot[-4:-1] == item or lot[-3:-1] == item):
        total_reward += int(prize[-1])
    return total_reward
def digit_prizes (lot,prizes):
    total_reward = 0
    for reward in prize:
      for item in reward:
        if isinstance(item, str) and (lot[0:3] == item or lot[-4:-1] == item or lot[-3:-1] == item):
          total_reward += int(reward[-1])
    return total_reward
def total_prize (lot,all_prizes):
    return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prize(lot, all_prizes[6:])

6331410221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 29111]
test_total_prize1.0
[186005]
bytecount: {'code': 452, 'const': 548, 'code+const': 1000}
def prize_check(lot,prize):
    total_prizes = 0
    for winning_number in prize:
        if lot == winning_number:
            total_prizes += prize[-1]
    return total_prizes
def big_prizes(lot,prizes):
    total_big_win = 0
    for big_win in prizes:
        total_big_win += prize_check(lot,big_win)
    return total_big_win
def next_to_first(lot, prize):
    next_prize = 0
    for next_number in prize:
        if next_number == str(int(lot)-1) or next_number == str(int(lot)+1):
            next_prize += prize[-1]
    return next_prize
def first_digits_check(lot, prize):
    first_prize = 0
    for first_digit in prize:
        if first_digit == lot[:3]:
            first_prize = prize[-1]
    return first_prize
def last_digits_check(lot, prize):
    last_prize = 0
    for last_prize_number in prize:
        if last_prize_number == lot[-1:-2:-1] or last_prize_number == lot[-1:-3:-1]:
            last_prize = prize[-1]
    return last_prize
def digit_prizes(lot, prizes):
    first_p = 0
    last_p = 0
    for prize in prizes:
        first_p += first_digits_check(lot, prize)
        last_p += last_digits_check(lot, prize)
    digit_p = first_p + last_p
    return digit_p
def total_prize(lot,all_prizes):
    total_1 = 0
    total_2 = 0
    total_3 = 0
    for prize in all_prizes:
      total_1 = big_prizes(lot,all_prizes)
      total_2 = next_to_first(lot,all_prizes[5])
      total_3 = digit_prizes(lot,all_prizes)
    total = total_1 + total_2 + total_3
    return total

6532073821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[710, 7142, 0142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 29111]
test_total_prize1.0
[186005]
bytecount: {'code': 496, 'const': 768, 'code+const': 1264}
def prize_check(number,prize):
    m=0
    keys=prize[:-1]
    for k in keys :
        if number==k :
            m+=prize[-1]
    return m
def big_prizes(lot,prizes) :
    m=0
    for k in prizes :
        m+=prize_check(lot,k)
    return m
def next_to_first(lot,prize) :
    p=['000000','999999']
    if str(prize[0]) in p :
        if str(prize[0])=='999999' :
            check=['000000','999998']
        else :
            check=['999999','000001']
    else :
        check=[str(int(prize[0])+1),str(int(prize[0])-1)]
    if lot in check :
        m=prize[1]
    else :
        m=0
    return m
def first_digits_check(lot,prizes) :
    keys=prizes[:-1]
    m=0
    if lot[:3] in keys :
        m+=prizes[-1]
    return  m
def last_digits_check(lot,prize) :
    m=0
    if lot[:(len(prize[0]))]==prize[0] :
        m+=prize[-1]
    return m
def digit_prizes(lot,prizes):
    l=last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
    f=first_digits_check(lot,prizes[0])
    return f+l
def total_prize(lot,all_prizes):
    a=big_prizes(lot,all_prizes[0:6])
    b=next_to_first(lot,all_prizes[5])
    c=digit_prizes (lot,all_prizes[6:])
    return a+b+c

6630002021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 71, 71]
test_first_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1256, 'const': 1308, 'code+const': 2564}
def prize_check (lot,prize):
    reward = 0
    reward_s = 0
    for i in prize :
        if lot == i :
          reward = prize[len(prize)-1]
          reward_s += reward
    return reward_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    reward1 = 0
    reward1_s = 0
    for k in prizes :
        for j in k :
            if lot == j :
              reward1 = k[len(k)-1]
              reward1_s += reward1
    return reward1_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    reward2 = 0
    reward2_s = 0
    lotall=int(lot)
    lot_for_d='1'+lot
    lot_for_d_i=int(lot_for_d)
    lot_down=lot_for_d_i-1
    lot11=str(lot_down)
    lot111='0'*(6-int(len(lot11)))+lot11
    lot_downn=lot111[-6::]
    lot_up=lotall+1
    lot22=str(lot_up)
    lot222='0'*(6-int(len(lot22)))+lot22
    lot_upp=lot222[-6::]
    for l in prize :
      if lot_upp == l or lot_downn == l :
          reward2 = prize[len(prize)-1]
          reward2_s += reward2
    return reward2_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    reward3 = 0
    reward3_s = 0
    lot123 = lot[:3]
    for o in all_prizes[6] :
        if lot123 == o :
            reward3 = all_prizes[6][len(all_prizes[6])-1]
            reward3_s += reward3
    return reward3_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    reward4 = 0
    reward4_s = 0
    lotlast2 = lot[-2:]
    lotlast3 = lot[-3:]
    for p in all_prizes[7] :
        if lotlast3 == p :
            reward4 = all_prizes[7][len(all_prizes[7])-1]
            reward4_s += reward4
    for q in all_prizes[8] :
        if lotlast2 == q :
            reward4 = all_prizes[8][len(all_prizes[8])-1]
            reward4_s += reward4
    return reward4_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    reward5 = 0
    reward5_s = 0
    lot2 = lot[:3]
    lotlast2 = lot[-2:]
    lotlast3 = lot[-3:]
    for o in all_prizes[6] :
        if lot2 == o :
            reward5 = all_prizes[6][len(all_prizes[6])-1]
            reward5_s += reward5
    for p in all_prizes[7] :
        if lotlast3 == p :
            reward5 = all_prizes[7][len(all_prizes[7])-1]
            reward5_s += reward5
    for q in all_prizes[8] :
        if lotlast2 == q :
            reward5 = all_prizes[8][len(all_prizes[8])-1]
            reward5_s += reward5
    return reward5_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    rewardr = 0
    rewardr_s = 0
    lotlast2 = lot[-2:]
    lotfirst3= lot[:-3]
    lotlast3 = lot[-3:]
    lotall=int(lot)
    lot_for_d='1'+lot
    lot_for_d_i=int(lot_for_d)
    lot_down=lot_for_d_i-1
    lot11=str(lot_down)
    lot111='0'*(6-int(len(lot11)))+lot11
    lot_downn=lot111[-6::]
    lot_up=lotall+1
    lot22=str(lot_up)
    lot222='0'*(6-int(len(lot22)))+lot22
    lot_upp=lot222[-6::]
    for v in all_prizes[:4] :
        for u in v :
            if lot == u :
              rewardr = v[len(v)-1]
              rewardr_s += rewardr
    k = all_prizes[5]
    for i in k:
        if lot_upp == i or lot_downn == i :
            rewardr = k[len(k)-1]
            rewardr_s += rewardr
    for me in all_prizes[6] :
        if lotfirst3 == me :
            rewardr = all_prizes[6][len(all_prizes[6])-1]
            rewardr_s += rewardr
    for g in all_prizes[7] :
        if lotlast3 == g :
            rewardr = all_prizes[7][len(all_prizes[7])-1]
            rewardr_s += rewardr
    for you in all_prizes[8] :
        if lotlast2 == you :
            rewardr = all_prizes[8][len(all_prizes[8])-1]
            rewardr_s += rewardr
    return rewardr_s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630019721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[40000111111, 4000056789, 123400005, 0]
test_prize_check_20.0
[24680000, 123700002, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 576, 'const': 770, 'code+const': 1346}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    total_prize = 0
    for x in prize :
        if lot == x :
            total_prize += 6000000
    total_prize = 0
    for y in prize :
        if lot == y :
            total_prize += 40000
    return total_prize
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    total_prizes = 0
    for i in prizes:
        for k in i :
            if lot==k:
                total_prizes +=int(i[-1])
    return total_prizes
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    total_prize = 0
    lot_num = int(lot)
    for prize_num in prize:
        prize_num = int(prize_num)
        if prize_num == lot_num - 1 or prize_num == lot_num + 1:
            total_prize += prize[1]
        else:
            if lot == prize[0]:
                return 0
            if lot == '000000':
                return int(prize[1])
            elif lot == '999999':
                return int(prize[1])
    return total_prize
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    total_prize = 0
    lot = lot[:3]
    for x in prize :
        if lot == x :
            total_prize += 4000
    return total_prize
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    total_prize = 0
    lot = lot[-2:]
    for x in prize :
        if lot == x :
            total_prize += 2000
    return total_prize
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    total_prizes = 0
    for x in prizes:
        for y in x:
            if lot[:3] == y or lot[3:] == y or lot[4:] == y:
                total_prizes += int(x[-1])
    return total_prizes
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    total_prizes = 0
    total_prizes += big_prizes(lot, all_prizes[:5])
    total_prizes += next_to_first(lot, all_prizes[5])
    total_prizes += digit_prizes(lot, all_prizes[6:])
    return total_prizes

6630028321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0
[21860015]
bytecount: {'code': 958, 'const': 940, 'code+const': 1898}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    #print(len(prize))
    s = 0
    for i in range(len(prize) - 1):
        if lot == prize[i]:
            s += prize[-1]
    return s
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    s = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i]) - 1):
            if lot == prizes[i][j]:
                s += prizes[i][-1]
    return s
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
        return prize[1]
    else:
        return 0
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    s = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
            s += prize[-1]
    return s
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    s = 0
    check_lot_last3 = lot[-4:-1]
    check_lot_last2 = lot[-3:-1]
    for i in range(len(prize)):
        if check_lot_last2 == prize[i] or check_lot_last3 == prize[i]:
                s += prize[-1]
    return s
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    s = 0
    for i in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][i]:
            s += prizes[0][-1]
    for i in range(len(prizes[1])-1):
        if lot[2:-1] == prizes[1][i]:
            s += prizes[1][-1]
    for i in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][i]:
            s += prizes[2][-1]
    return s
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    s = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1):
            if lot == all_prizes[i][j]:
                s += all_prizes[i][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        s += all_prizes[5][1]
    for i in range(len(all_prizes[6])-1):
        if lot[:3] == all_prizes[6][i]:
            s += all_prizes[6][-1]
    for i in range(len(all_prizes[7])-1):
        if lot[2:-1] == all_prizes[7][i]:
            s += all_prizes[7][-1]
    for i in range(len(all_prizes[8])-1):
        if lot[3:-1] == all_prizes[8][i]:
            s = all_prizes[8][-1]
    return s

6630035721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[111111, 456789, 12345, '0']
test_prize_check_20.0
[None2468, None3702, None0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 11142, 14562]
test_last_digits_check_10.0
[0, None142, None142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 4912, 'const': 1766, 'code+const': 6678}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        if len(prize) == 2 :
            number1 = prize[0]
            if lot == number1 :
                reward1 = prize[1]
                return (reward1)
            else :
                return("0")
        if len(prize) == 3 :
            number1 = prize[0]
            number2 = prize[1]
            number3 = prize[2]
            if lot == number1 or lot == number2 :
                if lot == number1 and lot == number2 :
                    reward2 = prize[2]*2
                    return (reward2)
                else :
                    reward2 = prize[2]
                    return (reward2)
            else :
                return("0")
        if len(prize) == 4 :
            number1 = prize[0]
            number2 = prize[1]
            number3 = prize[2]
            number4 = prize[3]
            if lot == number1 or lot == number2 or lot == number3 :
                if (lot == number1 and lot == number2) or (lot == number1 and lot == number3) or (lot == number2 and lot == number3) :
                    if lot == number1 and lot == number2 and lot == number3 :
                        reward3 = prize[3]*3
                        return(reward3)
                    else :
                        reward3 = prize[3]*2
                        return(reward3)
                else :
                    reward3 = prize[3]
                    return(reward3)
            else :
                return("0")
        if len(prize) == 5 :
            number1 = prize[0]
            number2 = prize[1]
            number3 = prize[2]
            number4 = prize[3]
            number5 = prize[4]
            if lot == number1 or lot == number2 or lot == number3 or lot == number4 :
                if (lot == number1 and lot == number2) or (lot == number1 and lot == number3) or (lot == number1 and lot == number4) or (lot == number2 and lot == number3) or (lot == number2 and lot == number4) or (lot == number3 and lot == number4):
                    if (lot == number1 and lot == number2 and lot == number3) or (lot == number1 and lot == number2 and lot == number4) or (lot == number2 and lot == number3 and lot == number4):
                        if lot == number1 and lot == number2 and lot == number3 and lot == number4 :
                            reward4 = prize[4]*4
                            return(reward4)
                        else :
                            reward4 = prize[4]*3
                            return(reward4)
                    else :
                        reward4 = prize[4]*2
                        return(reward4)
                else :
                    reward4 = prize[4]
                    return(reward4)
            else :
                return("0")
        if len(prize) == 7 :
            number1 = prize[0]
            number2 = prize[1]
            number3 = prize[2]
            number4 = prize[3]
            number5 = prize[4]
            number6 = prize[5]
            if lot == number1 or lot == number2 or lot == number3 or lot == number4 or lot == number5 or lot == number6 :
                if (lot == number1 and lot == number2) or (lot == number1 and lot == number3) or (lot == number1 and lot == number4) or (lot == number1 and lot == number5)or (lot == number1 and lot == number6)                    or (lot == number2 and lot == number3) or (lot == number2 and lot == number4) or (lot == number2 and lot == number5) or (lot == number2 and lot == number6)                    or (lot == number3 and lot == number4) or (lot == number3 and lot == number5) or (lot == number3 and lot == number6)                    or (lot == number4 and lot == number5) or (lot == number4 and lot == number6)                    or (lot == number5 and lot == number6) :
                    if (lot == number1 and lot == number2 and lot == number3) or (lot == number1 and lot == number2 and lot == number4) or (lot == number1 and lot == number2 and lot == number5)or (lot == number1 and lot == number2 and lot == number6) or (lot == number1 and lot == number3 and lot == number4) or (lot == number1 and lot == number3 and lot == number5) or (lot == number1 and lot == number3 and lot == number6) or (lot == number1 and lot == number4 and lot == number5) or (lot == number1 and lot == number4 and lot == number6)or (lot == number1 and lot == number5 and lot == number6)                        or (lot == number2 and lot == number3 and lot == number4) or (lot == number2 and lot == number3 and lot == number5) or (lot == number2 and lot == number3 and lot == number6) or (lot == number2 and lot == number4 and lot == number5) or (lot == number2 and lot == number4 and lot == number6) or (lot == number2 and lot == number5 and lot == number6)                         or (lot == number3 and lot == number4 and lot == number5) or (lot == number3 and lot == number4 and lot == number6) or (lot == number3 and lot == number5 and lot == number6)                        or (lot == number4 and lot == number5 and lot == number6):
                        if (lot == number1 and lot == number2 and lot == number3 and lot == number4) or (lot == number1 and lot == number2 and lot == number3 and lot == number5) or (lot == number1 and lot == number2 and lot == number3 and lot == number6)                            or (lot == number1 and lot == number2 and lot == number4 and lot == number5) or (lot == number1 and lot == number2 and lot == number4 and lot == number6) or (lot == number1 and lot == number2 and lot == number5 and lot == number6)                            or (lot == number1 and lot == number3 and lot == number4 and lot == number5) or (lot == number1 and lot == number3 and lot == number4 and lot == number6) or (lot == number1 and lot == number3 and lot == number5 and lot == number6)                            or (lot == number1 and lot == number4 and lot == number5 and lot == number6)                            or (lot == number2 and lot == number3 and lot == number4 and lot == number5) or (lot == number2 and lot == number3 and lot == number4 and lot == number6) or (lot == number2 and lot == number3 and lot == number5 and lot == number6)                            or (lot == number2 and lot == number4 and lot == number5 and lot == number6) or (lot == number3 and lot == number4 and lot == number5 and lot == number6):
                            if (lot == number1 and lot == number2 and lot == number3 and lot == number4 and lot == number5) or (lot == number1 and lot == number2 and lot == number3 and lot == number4 and lot == number6) or (lot == number1 and lot == number2 and lot == number3 and lot == number5 and lot == number6) or (lot == number1 and lot == number2 and lot == number4 and lot == number5 and lot == number6) or (lot == number1 and lot == number3 and lot == number4 and lot == number5 and lot == number6) or (lot == number2 and lot == number3 and lot == number4 and lot == number5 and lot == number6):
                                if (lot == number1 and lot == number2 and lot == number3 and lot == number4 and lot == number5 and lot == number6):
                                    reward5 = prize[6]*6
                                    return(reward5)
                                else :
                                    reward5 = prize[6]*5
                                    return(reward4)
                            else :
                                reward5 = prize[6]*4
                                return(reward5)
                        else :
                            reward5 = prize[6]*3
                            return(reward5)
                    else :
                        reward5 = prize[6]*2
                        return(reward5)
                else :
                    reward5 = prize[6]
                    return(reward5)
            else :
                return("0")
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        totalreward = 0
        checkk1 = all_prizes[0]
        check1 = checkk1[:-1:]
        won1 = checkk1[-1::]
        won1 = won1[0]
        won1 = int(won1)
        checkk2 = all_prizes[1]
        check2 = checkk2[:-1:]
        won2 = checkk2[-1::]
        won2 = won2[0]
        won2 = int(won2)
        checkk3 = all_prizes[2]
        check3 = checkk3[:-1:]
        won3 = checkk3[-1::]
        won3 = won3[0]
        won3 = int(won3)
        checkk4 = all_prizes[3]
        check4 = checkk4[:-1:]
        won4 = checkk4[-1::]
        won4 = won4[0]
        won4 = int(won4)
        checkk5 = all_prizes[4]
        check5 = checkk5[:-1:]
        won5 = checkk5[-1::]
        won5 = won5[0]
        won5 = int(won5)
        if lot in check1 :
            totalreward += won1
        for i in range(len(check2)):
            if lot in check2[i] :
                totalreward += won2
        for i in range(len(check3)):
            if lot in check3[i] :
                totalreward += won3
        for i in range(len(check4)):
            if lot in check4[i] :
                totalreward += won4
        for i in range(len(check5)):
            if lot in check5[i] :
                totalreward += won5
        return (totalreward)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        totalprize = 0
        won = prize[1]
        won = int(won)
        numberr1 = prize[0]
        if numberr1 == '999999' :
            downfrom1 = '999998'
            upfrom1 = '000000'
            q = [downfrom1,upfrom1]
            if lot in q :
                totalprize += won
                return (totalprize)
        if numberr1 == '000000' :
            downfrom2 = '999999'
            upfrom2 = '000001'
            w = [downfrom2,upfrom2]
            if lot in w :
                totalprize += won
                return (totalprize)
        else :
            number1 = int(numberr1)
            downfrom = number1 - 1
            upfrom = number1 + 1
            x = [downfrom,upfrom]
            lot = int(lot)
            if lot in x :
                totalprize += won
                return (totalprize)
            else :
                return(0)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        totalprize = 0
        won = prize[2]
        won = int(won)
        number = prize[0:2:1]
        lot1 = lot[0:3:1]
        for i in range(len(number)):
            if lot1 == number[i] :
                totalprize += won
        return (totalprize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if len(prize) == 3 :
            totalprize1 = 0
            lot1 = lot[3:6:1]
            won1 = prize[2]
            won1 = int(won1)
            x1 = prize[0:2:1]
            for i in range(len(x1)):
                if lot1 == x1[i] :
                    totalprize1 += won1
            return (totalprize1)
        if len(prize) == 2 :
            totalprize2 = 0
            lot2 = lot[4:6:1]
            won2 = prize[1]
            won2 = int(won2)
            x2 = prize[0]
            if lot2 == x2 :
                totalprize2 += won2
            return (totalprize2)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        totalprize = 0
        case1 = prizes[0]
        case2 = prizes[1]
        case3 = prizes[2]
        number1 = [case1[0],case1[1]]
        number2 = [case2[0],case2[1]]
        number3 = [case3[0]]
        won1 = case1[2]
        won1 = int(won1)
        won2 = case2[2]
        won2 = int(won2)
        won3 = case3[1]
        won3 = int(won3)
        for i in range(len(number1)) :
            if lot[0:3:1] in number1[i]:
                totalprize += won1
        for i in range(len(number2)) :
            if lot[3:6:1] in number2[i]:
                totalprize += won2
        if lot[4:6:1] in number3 :
            totalprize += won3
        return(totalprize)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        totalprize = 0
        case1 = all_prizes[0]
        case2 = all_prizes[1]
        case3 = all_prizes[2]
        case4 = all_prizes[3]
        case5 = all_prizes[4]
        case6 = all_prizes[5] #รางวัลเลขใกล้เคียงราวัลที่ 1
        case7 = all_prizes[6] #เลขหน้า 3 ตัว
        case8 = all_prizes[7]
        case9 = all_prizes[8]
        won1 = case1[-1::]
        won1 = won1[0]
        won1 = int(won1)
        won2 = case2[-1::]
        won2 = won2[0]
        won2 = int(won2)
        won3 = case3[-1::]
        won3 = won3[0]
        won3 = int(won3)
        won4 = case4[-1::]
        won4 = won4[0]
        won4 = int(won4)
        won5 = case5[-1::]
        won5 = won5[0]
        won5 = int(won5)
        won6 = case6[-1::]
        won6 = won6[0]
        won6 = int(won6)
        won7 = case7[-1::]
        won7 = won7[0]
        won7 = int(won7)
        won8 = case8[-1::]
        won8 = won8[0]
        won8 = int(won8)
        won9 = case9[-1::]
        won9 = won9[0]
        won9 = int(won9)
        number1 = case1[:-1:]
        number2 = case2[:-1:]
        number3 = case3[:-1:]
        number4 = case4[:-1:]
        number5 = case5[:-1:]
        number6 = case6[:-1:]
        number7 = case7[:-1:]
        number8 = case8[:-1:]
        number9 = case9[:-1:]
        if lot in number1 :
            totalprize += won1
        for i in range(len(number2)):
            if lot in number2[i]:
                totalprize += won2
        for i in range(len(number3)):
            if lot in number3[i]:
                totalprize += won3
        for i in range(len(number4)):
            if lot in number4[i]:
                totalprize += won4
        for i in range(len(number5)):
            if lot in number5[i]:
                totalprize += won5
        for i in range(len(number7)):
            if lot[0:3:1] in number7[i] :
                totalprize += won7
        for i in range(len(number8)):
            if lot[3:6:1] in number8[i] :
                totalprize += won8
        for i in range(len(number9)):
            if lot[4:6:1] in number9[i] :
                totalprize += won9
        if number6 == '999999' :
            downfrom1 = '999998'
            upfrom1 = '000000'
            q = [downfrom1,upfrom1]
            if lot in q :
                totalprize += won6
        if number6 == '000000' :
            downfrom2 = '999999'
            upfrom2 = '000001'
            w = [downfrom2,upfrom2]
            if lot in w :
                totalprize += won6
        else :
            number6 = number6[0]
            number6 = int(number6)
            downfrom = number6 - 1
            upfrom = number6 + 1
            x = [downfrom,upfrom]
            lot = int(lot)
            if lot in x :
                totalprize += won6
        return(totalprize)

6630053021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_10.0
[0, 71, 071]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 536, 'const': 552, 'code+const': 1088}
def prize_check (lot,prizes):
    if lot in prizes:
        amount = prizes.count(lot)
        money = prizes[-1]*amount
        return money
    else:
        return 0
def big_prizes (lot,prizes):
    money = 0
    for i in range(len(prizes)):
        k = prize_check(lot,prizes[i])
        money += k
    return money
def next_to_first (lot,prizes):
    real_prizes = []
    for c in list(prizes):
        lot_num = int(lot)
        prize_num = int(c)
        if c != prizes[-1]:
            #รางวัลข้างเคียงยังไงก็มีแค่ 2 ตัว
            real_prizes.append(prize_num + 1)
            real_prizes.append(prize_num - 1)
    if lot_num in real_prizes:
        money = prizes[-1]
        return money
    else:
        return 0
def first_digits_check(lot,prize):
    for c in list(prize):
         if lot[0:3:] == c[0:3:]:
            money = prize[-1]
            return money
         else:
             return 0
def last_digits_check(lot,prize):
    for c in list(prize):
        if lot[-2:] == c[-2:] or lot[-3:] == c[-3:]:
            money = prize[-1]
            return money
        else:
            return 0
def digit_prizes (lot,prizes):
    money = 0
    for i in range(len(prizes)):
        if i in range(0): # list ของรางวัลเลขหน้า 3 ตัว
            k = first_digits_check(lot,prizes[i])
            money += k
        else: # list ของรางวัลเลขท้าย 3 ตัวและ 2 ตัว
            k = last_digits_check(lot,prizes[i])
            money += k
    return money
def total_prize (lot,all_prizes):
    return big_prizes(lot,all_prizes) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6630067821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0NameError("name 'prize_check' is not defined")
[111111, 456789, 12345, 0]
test_prize_check_20.0NameError("name 'prize_check' is not defined")
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 422, 'const': 592, 'code+const': 1014}
def big_prizes (lot,all_prizes):
    a=0
    for i in range(len(all_prizes)):
        for j in  range(len(all_prizes[i][:-1])):
            if lot in all_prizes[i][j]:
                 a+=all_prizes[i][-1]
    return a
def next_to_first (lot,all_prizes):
    a=0
    if int(lot) == int(all_prizes[0])+1 or int(lot)==int(all_prizes[0])-1:
        a+=all_prizes[-1]
    return a
def first_digits_check(lot,all_prizes):
    a=0
    if lot[0:3] in all_prizes:
        a+=all_prizes[-1]
    return a
def last_digits_check(lot,all_prizes):
    a=0
    if lot[4:] in all_prizes:
        a+=all_prizes[-1]
    if lot[3:] in all_prizes:
        a+=all_prizes[-1]
    return a
def digit_prizes (lot,all_prizes):
    c=first_digits_check(lot,all_prizes[0])+last_digits_check(lot,all_prizes[1])+last_digits_check(lot,all_prizes[2])
    return c
def total_prize (lot,all_prizes):
    c=big_prizes(lot,all_prizes[0:5])+digit_prizes (lot,all_prizes[6:])+next_to_first(lot,all_prizes[5])
    return c

6630089621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_10.0
[710, 71, 71]
test_first_digits_check_20.0
[710, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 582, 'const': 804, 'code+const': 1386}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        win=0
        for i in range(len(prize)) :
            if lot==prize[i] :
                win+=prize[-1]
        return win
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        a=prize_check(lot,all_prizes[0])
        b=prize_check(lot,all_prizes[1])
        c=prize_check(lot,all_prizes[2])
        d=prize_check(lot,all_prizes[3])
        e=prize_check(lot,all_prizes[4])
        win=a+b+c+d+e
        return win
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        a=int(prize[0])+1
        b=int(prize[0])-1
        x=[a,b]
        y=int(lot)
        win=0
        if y in x :
            win+=prize[-1]
        return win
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        win=0
        for i in range(len(prize)) :
            if lot[-3:]== prize[i] :
                win+=prize[-1]
        return win
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        win=0
        for i in range(len(prize)) :
            if lot[-3:]==prize[i] or lot[-2:]==prize[i] :
                win+=prize[-1]
        return win
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        a=first_digits_check(lot[:3],prizes[0])
        b=last_digits_check(lot[-3:],prizes[1])
        c=last_digits_check(lot[-2:],prizes[2])
        win=a+b+c
        return win
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a=big_prizes(lot,all_prizes[:5])
        b=next_to_first(lot,all_prizes[5])
        c=digit_prizes (lot,all_prizes[6:])
        win=a+b+c
        return win

6630097621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0AttributeError("'list' object has no attribute 'items'")
[186005]
bytecount: {'code': 614, 'const': 800, 'code+const': 1414}
def prize_check (lot,prize):
    # สร้างตัวแปร money_prize_check เพื่อเก็บผลรวมของเงินรางวัลที่ตรงกับหมายเลข lot
    money_prize_check = 0
    # วนลูปผ่านรางวัลทั้งหมดในรายการ prize
    for p in range(len(prize)):
        if lot == prize[p-1]:
            # ถ้าตรงกัน ให้เพิ่มจำนวนเงินรางวัลของ p เข้าไปใน money_prize_check
            money_prize_check += prize[-1]
    return money_prize_check
def big_prizes (lot,prizes):
    # สร้างตัวแปร total_big_prizes เพื่อเก็บผลรวมของเงินรางวัลใหญ่ที่เป็นของ lot
    total_big_prizes = 0
    # วนลูปผ่านรางวัลใหญ่ทั้งหมดในรายการ prizes
    for p in range(len(prizes)):
        for q in range(len(prizes[p])):
            if lot == prizes[p][q-1]:
                total_big_prizes += prizes[p][-1]
    return total_big_prizes
def next_to_first (lot,prize):
    # สร้างรายการ adjacent_numbers เพื่อเก็บเลขที่อยู่ข้างๆ เลขหน้าของรางวัลทั้งหมดในรายการ prize
    adjacent_numbers = [int(prize[0])-1, int(prize[0])+1]
    # สร้างตัวแปร money_next_to_first เพื่อเก็บจำนวนเงินรางวัลข้างเคียงเมื่อหมายเลข lot ตรงกับเลขหน้าของรางวัลที่ 1
    money_next_to_first = 0
    if int(lot) in adjacent_numbers:
        money_next_to_first += prize[-1]
    return money_next_to_first
def first_digits_check(lot,prize):
    # สร้างตัวแปร check_lot เพื่อเก็บเลขหน้า 3 ตัวของ lot
    check_lot = lot[:3]
    # สร้างตัวแปร money_first_digits_check เพื่อเก็บจำนวนเงินรางวัลเลขหน้า 3 ตัว
    money_first_digits_check = 0
    for i in range(len(prize)):
        if check_lot == prize[i-1]:
            money_first_digits_check += prize[-1]
    return money_first_digits_check
def last_digits_check(lot,prize):
    # สร้างตัวแปร money_last_digits_check เพื่อเก็บจำนวนเงินรางวัลเลขท้าย 2 ตัว
    money_last_digits_check = 0
    # สร้างตัวแปร check_lot_last3 เพื่อเก็บเลขท้าย 3 ตัวของ lot
    check_lot_last3 = lot[-4:-1]
    # สร้างตัวแปร check_lot_last2 เพื่อเก็บเลขท้าย 2 ตัวของ lot
    check_lot_last2 = lot[-3:-1]
    for i in range(len(prize)):
        if check_lot_last2 == prize[i] or check_lot_last3 == prize[i]:
                money_last_digits_check += prize[-1]
    return money_last_digits_check
    # ส่งค่าเงินรางวัลเลขท้าย 2 ตัวออกจากฟังก์ชัน
    return money_last_digits_check
def digit_prizes (lot,prizes):
    # สร้างรายการ check_lot_list เพื่อเก็บเลขหน้า 3 ตัว, เลขท้าย 3 ตัว, และเลขท้าย 2 ตัวของ lot
    check_lot_list = [lot[:3], lot[-4:-1],  lot[-3:-1]]
    # สร้างตัวแปร total_digit_prizes เพื่อเก็บผลรวมของเงินรางวัลเลขหน้าและเลขท้ายที่ตรงกับ lot
    total_digit_prizes = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i])):
            if check_lot_list[i] == prizes[i][j-1]:
                total_digit_prizes += prizes[i][-1]
    return total_digit_prizes
def total_prize(lot, all_prizes):
    # สร้างตัวแปร total_money เพื่อเก็บผลรวมเงินรางวัลทั้งหมด
    total_money = 0 + (digit_prizes(lot, all_prizes[6:]))  # เริ่มต้นด้วยเงินรางวัลเลขหน้าและเลขท้าย
    # วนลูปผ่านรายการรางวัลทั้งหมดใน all_prizes
    for prize_dict in all_prizes:
        # วนลูปผ่านคีย์และค่าในรางวัลแต่ละรางวัล
        for key, value in prize_dict.items():
            # เรียกใช้ฟังก์ชัน prize_check เพื่อตรวจสอบเงินรางวัลของ lot ในรางวัล key:value และเพิ่มผลลัพธ์เข้ากับ total_money
            total_money += prize_check(lot, {key: value})
    # ส่งค่าผลรวมเงินรางวัลทั้งหมดออกจากฟังก์ชัน
    return total_money

6630226221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_10.0TypeError("unsupported operand type(s) for +=: 'int' and 'str'")
[0, 7142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 400023, 400023, 029, 029, 200053]
test_digit_prizes_20.0
[0, 2000111]
test_total_prize0.0
[1860045]
bytecount: {'code': 702, 'const': 1020, 'code+const': 1722}
def prize_check(lot, prize):
    total_prize = 0
    for prize_list in prize:
        if lot == prize_list:
            total_prize += prize[-1]
    return total_prize
def big_prizes(lot, prizes):
    total_prize = 0
    for prize_list in prizes:
        for prize_number in prize_list:
            if lot == prize_number:
                total_prize += prize_list[-1]
    return total_prize
def next_to_first (lot,prize):
    money=0
    for p in range(len(prize)-1):
        if int(lot)==int(prize[p])-1 or int(lot)==int(prize[p])+1:
            money+=int(prize[-1])
        elif prize[p]=='000000' and( lot=='000001' or lot=='999999'):
                money+=int(prize[-1])
        elif prize[p]=='999999' and(lot=='000000' or lot=='999998'):
                money+=int(prize[-1])
    return money
def first_digits_check(lot, prize):
    lot_first_three = lot[:3]
    total_prize = 0
    for prize_list in prize:
        if isinstance(prize_list, list):
            for p in prize_list:
                if lot_first_three == str(p):
                    total_prize += 4000
        else:
            if lot_first_three == str(prize_list):
                total_prize += 4000
    return total_prize
def last_digits_check(lot, prize):
    lot_str = str(lot[-2:])
    total_prize = 0
    for p in range(0, len(prize),2):
        if lot_str == str(prize[p])[-2:]:
            total_prize += prize[p+1]
    return total_prize
def digit_prizes(lot, prizes):
    total_prize = 0
    for prize in prizes[0]:
        if lot[:3] == prize:
            total_prize += 4000
    for prize in prizes[2]:
        if lot[-2:] == prize:
            total_prize += 2000
    return total_prize
def total_prize(lot, all_prizes):
    total = 0
    total += prize_check(lot, all_prizes[0])
    total += prize_check(lot, all_prizes[3])
    total += next_to_first(lot, all_prizes[5])
    total += last_digits_check(lot, all_prizes[8])
    total += first_digits_check(lot, all_prizes[6])
    return total

6631020421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 28142, 28142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 16911]
test_total_prize0.0
[61860065]
bytecount: {'code': 1042, 'const': 968, 'code+const': 2010}
def prize_check(lot,prize):
    reward_list = []
    if lot in prize:
        reward = prize[-1]
    else:
        reward = 0
    num = prize.count(lot)
    if num > 1:
        reward = reward*num
    reward_list.append(reward)
    reward = sum(reward_list)
    return reward
def big_prizes(lot,prizes):
    reward_list = []
    for n in prizes:
        if lot in n:
            j = prizes.index(n)
            reward = prizes[j][-1]
            num = n.count(lot)
            if num > 1:
              reward = reward*num
            reward_list.append(reward)
        else:
            reward = 0
            reward_list.append(reward)
    rewards = sum(reward_list)
    return rewards
def next_to_first(lot,prize):
    check1_list = []
    check2_list = []
    if prize[0] == '000000':
        check1 = '999999'
        check2 = '000001'
        check1_list.append(check1)
        check2_list.append(check2)
    elif prize[0] == '999999':
        check1 = '999998'
        check2 = '000000'
        check1_list.append(check1)
        check2_list.append(check2)
    else:
        num = int(prize[0])
        check1 = num - 1
        check2 = num + 1
        check1 = str(check1)
        check2 = str(check2)
        check1_list.append(check1)
        check2_list.append(check2)
    lot = int(lot)
    if lot == 999999:
        lot_check1 = '999998'
        lot_check2 = '000000'
        if lot_check1 in check1:
          reward = prize[-1]
        elif lot_check2 in check2:
          reward = prize[-1]
        else:
          reward = 0
    elif lot == 000000:
        lot_check1 = '999999'
        lot_check2 = '000001'
        if lot_check1 in check1:
          reward = prize[-1]
        elif lot_check2 in check2:
          reward = prize[-1]
        else:
          reward = 0
    else:
        lot_check = str(lot)
        if lot_check in check1_list:
          reward = prize[-1]
        elif lot_check in check2_list:
          reward = prize[-1]
        else:
          reward = 0
    for lot in prize:
      n = prize.count(lot)
      reward = reward*n
    return reward
def first_digits_check(lot,prize):
    if str(lot[:3]) in prize: #3ตัวหน้า
        reward = prize[-1]
    else:
        reward = 0
    for lot in prize:
      n = prize.count(lot)
      if n > 1:
        reward = reward*n
    return reward
def last_digits_check(lot,prize):
    if str(lot[3:]) in prize: #3ตัวท้าย
        reward = prize[-1]
    if str(lot[4:]) in prize: #2ตัวท้าย
        reward = prize[-1]
    else:
        reward = 0
    for lot in prize:
        n = prize.count(lot)
        if n > 1:
          reward = reward*n
    return reward
def digit_prizes(lot,prizes):
    reward_list = []
    lot = str(lot)
    for n in prizes:
        reward_list.append(first_digits_check(lot,n))
        reward_list.append(last_digits_check(lot,n))
    reward = sum(reward_list)
    return reward
def total_prize(lot,all_prizes):
    lot = str(lot)
    reward_list = []
    for n in all_prizes:
        r1 = next_to_first(lot,n)
        r2 = prize_check(lot,n)
        r3 = first_digits_check(lot,n)
        r4 = last_digits_check(lot,n)
        reward_list.append(r1)
        reward_list.append(r2)
        reward_list.append(r3)
        reward_list.append(r4)
    if lot != all_prizes[0][0] and 6000000 in reward_list:
        reward_list.remove(6000000)
    if lot == all_prizes[5][0] and 100000 in reward_list:
        reward_list.remove(100000)
    total_reward = sum(reward_list)
    return total_reward

6631113121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[11083]
test_big_prizes_20.0
[11083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0AttributeError("'str' object has no attribute 'str'")
[186005]
bytecount: {'code': 852, 'const': 828, 'code+const': 1680}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        p = 0
        n = [x for x in prize if x==lot]
        p += len(n)*prize[-1]
        return p
def big_prizes (lot,prizes):
        p = 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        for i in prizes :
          n = [x for x in i if x==lot]
          p += len(n)*i[-1]
          return p
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        p = 0
        n = [x for x in prize if str(int(x)-1)==lot or str(int(x)+1)==lot]
        p += len(n)*prize[-1]
        return p
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        lot = lot[:3]
        p = 0
        n = [x for x in prize if x==lot]
        p += len(n)*prize[-1]
        return p
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        p = 0
        n = [x for x in prize if x == lot3 or x == lot2]
        p += len(n)*prize[-1]
        return p
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        p = 0
        lot3_f = lot[:3]
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        for i in prizes :
          n = [x for x in i if x==lot2 or x==lot3 or x==lot3_f]
          p += len(n)*i[-1]
          return p
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        all_prize[5] = [str(int(all_prizes[5][0])-1).str(int(all_prizes[5][0]+1).all_prize[5][1])]
        p = 0
        lot3_f = lot[:3]
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        for i in all_prizes :
          n = [x for x in i if x==lot or x==lot2 or x==lot3 or x==lot_f]
          p += len(n)*i[-1]
        return p

6631114821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 100000987, 100000987]
test_next_to_first_20.0
[None0, None987, None987, 100000987, 100000987, None987, None987]
test_first_digits_check_10.0
[0, 400071, 400071]
test_first_digits_check_20.0
[0, 8000142, 8000142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 400023, 400023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860035]
bytecount: {'code': 504, 'const': 716, 'code+const': 1220}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        totalPrice = 0
        for winNumber in prize[:-1]:
          if lot == winNumber:
            totalPrice += prize[-1]
        return totalPrice
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        totalPrice = 0
        for priceList in prizes:
          totalPrice += prize_check(lot, priceList)
        return totalPrice
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if lot == str(int(prize[0]) - 1) or lot == str(int(prize[0]) + 1):
          return 100000
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        totalPrice = 0
        for winNumber in prize[:-1]:
          if lot[:3] == winNumber:
            totalPrice += 4000
        return totalPrice
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        price = 0
        if len(prize[0]) == 2:
          lastDigitLot = lot[-2:]
        elif len(prize[0]) == 3:
          lastDigitLot = lot[-3:]
        else:
          return
        for winNumber in prize[:-1]:
          if lastDigitLot == winNumber:
            price += prize[-1]
        return price
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        totalPrice = 0
        totalPrice += first_digits_check(lot, prizes[0])
        totalPrice += last_digits_check(lot, prizes[1])
        totalPrice += last_digits_check(lot, prizes[2])
        return totalPrice
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        totalPrice = 0
        totalPrice += big_prizes(lot, all_prizes[:5])
        totalPrice += next_to_first(lot, all_prizes[5])
        totalPrice += digit_prizes(lot, all_prizes[6:])
        return totalPrice

6631119021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize0.0
[2341860205]
bytecount: {'code': 790, 'const': 940, 'code+const': 1730}
def prize_check (lot,prize):
    if lot in prize:
        count = prize.count(lot)
        sum_money = prize[-1]*count
    else:
        sum_money = 0
    return sum_money
def big_prizes (lot,prizes):
    sum_money = 0
    for e in prizes :
        if lot in e :
            counter = e.count(lot)
            sum_money += e[-1]*counter
    return sum_money
def next_to_first (lot,prize) :
    check = int(prize[0])
    x = int(lot)
    if x == check+1:
        sum_money = prize[-1]
    else :
        sum_money = 0
    if x == check-1:
        sum_money = prize[-1]
    else:
        sum_money = 0
    return sum_money
def first_digits_check(lot,prize) :
    first_3digit = int(lot[:3])
    if str(first_3digit) in prize:
      sum_money = prize[-1]
    else:
      sum_money = 0
    return sum_money
def last_digits_check(lot,prize):
    last_3digit = int(lot[3:])
    last_2digit = int(lot[4:])
    sum_money = 0
    if str(last_3digit) in prize:
      sum_money = prize[-1]
    elif str(last_2digit) in prize:
      sum_money = prize[-1]
    return sum_money
def digit_prizes (lot,prizes):
    last_3digit = int(lot[3:])
    last_2digit = int(lot[4:])
    first_3digit = int(lot[:3])
    sum_money = 0
    if str(first_3digit) in prizes[0]:
        sum_money += prizes[0][-1]
    if str(last_3digit) in prizes[1]:
        sum_money += prizes[1][-1]
    if str(last_2digit) in prizes[2]:
        sum_money += prizes[2][-1]
    return sum_money
def total_prize (lot,all_prizes):
    prizes = all_prizes[0:]
    last3 = int(lot[3:])
    last2 = int(lot[4:])
    first3 = int(lot[:3])
    check = int(prizes[5][0])
    num = int(lot)
    sum_money = 0
    if num == check+1:
        sum_money += 100000
    elif num == check-1:
        sum_money += 100000
    for e in prizes:
        if lot in e:
            counter = e.count(lot)
            sum_money += e[-1]*counter
        if str(first3) in prizes[6]:
            sum_money += prizes[6][-1]
        if str(last3) in prizes[7]:
            sum_money += prizes[7][-1]
        if str(last2) in prizes[8]:
            sum_money += prizes[8][-1]
    return sum_money

6631131421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_20.0
[None0, None0, None71]
test_digit_prizes_10.0NameError("name 'prize' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'prize' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_priczes' is not defined")
[186005]
bytecount: {'code': 626, 'const': 824, 'code+const': 1450}
def prize_check (lot,prize):
  s = 0
  for num in prize[:-1]:
    if lot == num:
      s += int(prize[-1])
  return s
def big_prizes (lot,prizes):
  s = 0
  for prize in prizes:
    s += prize_check (lot,prize)
  return s
def next_to_first (lot,prize):
  s = 0
  next_to = []
  first,p = prize
  if first == "000000" :
    next_to += ["999999" , "000001"]
  elif first == "999999":
    next_to += ["999998","000000"]
  else:
    next_to += [str(int(first)-1), str(int(first)+1)]
  for num in next_to:
    if lot == num:
      s += p
  return s
def first_digits_check(lot,prize):
  s = 0
  for num in prize[: -1]:
    if lot[:3] == num:
      s += prize[-1]
  return s
def last_digits_check(lot,prize):
  s = 0
  for num in prize[:-1]:
    if len(num) == 3:
      if lot[-3:] == num:
        s += prize[-1]
      elif len(num) == 2:
        if lot[-2:] == num:
          s += prize[-1]
      else:
        pass
      return s
def digit_prizes (lot,prizes):
  s = 0
  for i in range (len(prize)):
    if i == 0:
      s += first_digits_check(lot,prizes[i])
    else:
      s += last_digits_check(lot,prizes[i])
    return s
def total_prize (lot,all_prizes):
  s = 0
  s += big_prizes(lot,all_priczes[:5])
  s += next_to_first(lot,all_prizes[5])
  s += digit_prizes (lot,all_prizes[6:])
  return s

6631139521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_20.0
[2951083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize0.0
[1860045]
bytecount: {'code': 792, 'const': 940, 'code+const': 1732}
def prize_check (lot,prize):
        if lot in prize:
          count = prize.count(lot)
          result = prize[-1]*count
        else:
          result = 0
        return result
def big_prizes (lot,prizes):
  result = 0
  for e in prizes:
      if lot in e:
        counter = e.count(lot)
        result = 0
        result += e[-1]*counter
  return result
def next_to_first (lot,prize):
    check = int(prize[0])
    num = int(lot)
    if num == check+1:
      result = prize[-1]
    elif num == check-1:
      result = prize[-1]
    else:
      result = 0
    return result
def first_digits_check(lot,prize):
    first3 = int(lot[:3])
    if str(first3) in prize:
      result = prize[-1]
    else:
      result = 0
    return result
def last_digits_check(lot,prize):
    last3 = int(lot[3:])
    last2 = int(lot[4:])
    result = 0
    if str(last3) in prize:
      result = prize[-1]
    elif str(last2) in prize:
      result = prize[-1]
    return result
def digit_prizes (lot,prizes):
    last3 = int(lot[3:])
    last2 = int(lot[4:])
    first3 = int(lot[:3])
    result = 0
    if str(first3) in prizes[0]:
      result += prizes[0][-1]
    if str(last3) in prizes[1]:
      result += prizes[1][-1]
    if str(last2) in prizes[2]:
      result += prizes[2][-1]
    return result
def total_prize (lot,all_prizes):
  prizes = all_prizes[0:]
  last3 = int(lot[3:])
  last2 = int(lot[4:])
  first3 = int(lot[:3])
  check = int(prizes[5][0])
  num = int(lot)
  result = 0
  if num == check+1:
      result += 100000
  elif num == check-1:
      result += 100000
  for e in prizes:
      if lot in e:
        counter = e.count(lot)
        result += e[-1]*counter
  if str(first3) in prizes[6]:
        result += prizes[6][-1]
  if str(last3) in prizes[7]:
        result += prizes[7][-1]
  if str(last2) in prizes[8]:
        result += prizes[8][-1]
  return result

6631208121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 1030, 'const': 996, 'code+const': 2026}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    cnt = 0
    for i in range(len(prize) - 1):
        if lot == prize[i]:
            cnt += 1
    return cnt * prize[-1]
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    allmoney = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i]) - 1):
            if lot == prizes[i][j]:
                allmoney += prizes[i][-1]
    return allmoney
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1:
        money = prize[-1]
    else:
        money = 0
    return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    cnt = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
            cnt =+ prize[-1]
    return cnt
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    x = len(prize[0])
    cnt = 0
    if x == 2:
        for i in range(len(prize)-1):
            if lot[3:-1] == prize[i]:
                cnt = cnt + prize[-1]
    if x == 3:
        for i in range(len(prize)-1):
            if lot[2:-1] == prize[i]:
                cnt = cnt + prize[-1]
    return cnt
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    cnt = 0
    for i in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][i]:
            cnt = cnt + prizes[0][-1]
    for i in range(len(prizes[1])-1):
        if lot[2:-1] == prizes[1][i]:
            cnt += prizes[1][-1]
    for i in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][i]:
            cnt += prizes[2][-1]
    return cnt
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    cnt = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1):
            if lot == all_prizes[i][j]:
                cnt += all_prizes[i][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        cnt += all_prizes[5][1]
    for i in range(len(all_prizes[6])-1):
        if lot[:3] == all_prizes[6][i]:
            cnt += all_prizes[6][-1]
    for i in range(len(all_prizes[7])-1):
        if lot[2:-1] == all_prizes[7][i]:
            cnt += all_prizes[7][-1]
    for i in range(len(all_prizes[8])-1):
        if lot[3:-1] == all_prizes[8][i]:
            cnt += all_prizes[8][-1]
    return cnt

6631466721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 0987, 0987]
test_first_digits_check_10.0
[0, 71, 071]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 758, 'const': 976, 'code+const': 1734}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = []
        for i in prize[:len(prize)-1]:
          if i == lot:
            money.append(prize[-1])
        return sum(money)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        k=0
        money=[]
        while k<len(prizes):
          for i in prizes[k][:len(prizes[k])-1]:
            if i == lot:
              money.append(prizes[k][-1])
          k+=1
        return sum(money)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money=[]
        if prize[0] == 000000:
          a = ['999999','000001']
        elif prize[0] == 999999:
          a = ['999998','000000']
        else:
          a1 = int(prize[0])
          b1 = str(a1-1)
          b2 = str(a1+1)
          a = [b1,b2]
          k=0
          i=0
        while i<2:
          if lot == a[k]:
            money.append(100000)
          i+=1
          k+=1
        return sum(money)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        k=0
        b=[]
        money=[]
        while k<len(prize)-1:
          a = str(prize[k])
          aa = a[:3]
          aaa = str(aa)
          b.append(aaa)
          k+=1
        c = lot[:3]
        for i in b[:len(b)-1]:
          if i == c:
            money.append(prize[-1])
        return sum(money)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        money=[]
        for i in prize[:len(prize)-1]:
          if i == lot[4:] or i == lot[3:]:
            money.append(prize[-1])
        return sum(money)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        a = first_digits_check(lot,prizes[0])
        b = last_digits_check(lot,prizes[1])
        c = last_digits_check(lot,prizes[2])
        return a+b+c
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a = big_prizes(lot,all_prizes)
        b = next_to_first(lot,all_prizes[5])
        c = digit_prizes(lot,all_prizes[6:])
        return a+b+c

6631546221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize0.0
[18460045]
bytecount: {'code': 540, 'const': 776, 'code+const': 1316}
def prize_check (lot,prize):
    money = 0
    for i in prize[:len(prize)-1]:
        if lot == i:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
    money = 0
    for i in prizes:
        for j in i[:len(i)-1]:
            if lot == j:
                money += i[-1]
    return money
def next_to_first (lot,prize):
    money = 0
    a = [int(prize[0]) + 1, int(prize[0]) - 1]
    for i in a:
        if int(lot) == i:
            money += prize[-1]
    return money
def first_digits_check(lot,prize):
    money = 0
    for i in prize[:len(prize)-1]:
        if lot[:3] == i:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    for i in prize[:len(prize)-1]:
        if lot[:3] == i:
            money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    money = 0
    for i in prizes[0][:len(prizes[0])-1]:
        if lot[:3] == i:
                money += prizes[0][-1]
    return money + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
    return big_prizes (lot,all_prizes[:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6632006921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 7142, 7142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize1.0
[186005]
bytecount: {'code': 486, 'const': 632, 'code+const': 1118}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for code in prize[:-1]:
                if lot == code:
                        money += prize[-1]
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for prize in prizes:
                money += prize_check(lot, prize)
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        if lot in {str(int(prize[0])-1), str(int(prize[0])-1)}:
                money += prize[-1]
        return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for code in prize[:-1]:
                if lot[0:3] == code:
                        money += prize[-1]
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        money = 0
        if len(prize[0]) == 2:
                for code in prize[:-1]:
                        if lot[0:2] == code:
                                money += prize[-1]
        else:
                for code in prize[:-1]:
                        if lot[0:3] == code:
                                money += prize[-1]
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes[0:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6632093421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 836, 'const': 1076, 'code+const': 1912}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        x=0
        i=0
        for i in range(len(prize)-1):
          if lot == prize[i]:
            x+=prize[-1]
          else:
            x+=0
        return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        i=0
        x=0
        for i in range(len(prizes)):  #ทำงานไปทีละชนิดรางวัล
          j=0
          for j in range(len(prizes[i])-1):        #ทำงานกับทุกเลขใน 1 รางวัล
            if lot == prizes[i][j]:
              x+=prizes[i][-1]
            else:
              x+=0
        return x
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if prize[0] == '000000': #prize0 คือเลขรางวัลที่ 1 จริงๆ
          top = '000001'        #top down ถือเป็นเลขรางวัลเคียง
          down = '999999'       #lot เท่านั้นที่เป็นของคนซื้อ - ตัวเช็ค
        elif prize[0] == '999999':
          top = '000000'
          down = '999998'
        else:
          top = str(int(prize[0])+1)
          down = str(int(prize[0])-1)
        #chexk part
        if lot == top or lot == down:
          x = prize[-1]
        else:
          x = 0
        return x
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        lot3 = lot[:3]
        i = 0
        x = 0
        for i in range(len(prize)-1):
          if lot3 == prize[i]:
            x += prize[-1]
          else:
            x += 0
        return x
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if prize == all_prizes[7]:    #tail 3
          lot3 = lot[3:]
          i = 0
          x = 0
          for i in range(2):
            if lot3 == prize[i]:
              x += prize[-1]
            else:
              x += 0
        elif prize == all_prizes[8]:    #tail 2
          lot2 = lot[4:]
          x = 0
          if lot2 == prize[0]:
            x += prize[-1]
          else:
            x += 0
        else:
          x = 0
        return x
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        i = 0
        x = 0
        for i in range(len(prizes)):
          if prizes[i] == all_prizes[6]:
            x += first_digits_check(lot,all_prizes[6])
          else:
            x += 0
          if prizes[i] == all_prizes[7]:
            x += last_digits_check(lot,all_prizes[7])
          else:
            x += 0
          if prizes[i] == all_prizes[8]:
            x += last_digits_check(lot,all_prizes[8])
          else:
            x += 0
        return x
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        x = 0
        x += big_prizes(lot,all_prizes[:5])
        x += next_to_first (lot,all_prizes[5])
        x += digit_prizes (lot,all_prizes[6:])
        return x

6632106021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 670, 'const': 604, 'code+const': 1274}
def prize_check (lot,prize):
    p = 0
    for i in range (0,len(prize)-1):
        if str(lot) == prize[i]:
            p += prize[len(prize)-1]
            # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
            # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
            # คืนผลรวมของเงินรางวัลที่ได้
    return p
def big_prizes (lot,prizes):
    p = 0
    for i in range (0,len(prizes)):
        p += prize_check(lot,prizes[i])
    return p
def next_to_first (lot,prize):
    p = 0
    for i in range (0,len(prize)-1):
        if abs(int(lot)-int(prize[i])) == 1:
            p += prize[len(prize)-1]
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    return p
def first_digits_check(lot,prize):
    p = 0
    for i in range (0,len(prize)-1):
        if lot[:3] == prize[i]:
            p += prize[len(prize)-1]
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    p = 0
    if prize == all_prizes[8]:
        for i in range (0,len(prize)-1):
            if lot[len(lot)-2:] == prize[i]:
                p += prize[len(prize)-1]
    elif prize == all_prizes[7]:
        for i in range (0,len(prize)-1):
            if lot[len(lot)-3:] == prize[i]:
                p += prize[len(prize)-1]
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    p = 0
    for i in range (0,len(prizes)):
        p += last_digits_check(lot,prizes[i])
        p += first_digits_check(lot,prizes[i])
    return p
def total_prize (lot,all_prizes):
    p = 0
    for i in range (0,5):
        p += prize_check (lot,all_prizes[i])
    p+= digit_prizes(lot,all_prizes[6:])
    p+= next_to_first(lot,all_prizes[5])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    return p

6632123621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[None0, 71, 71]
test_first_digits_check_20.0
[None0, 7142, 7142]
test_last_digits_check_10.0
[None0, 7142, 7142]
test_last_digits_check_20.0
[None0, None0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 768, 'const': 804, 'code+const': 1572}
def prize_check (lot,prize):
  n = 0
  for i in range(len(prize)):
    if lot == prize[i]:
      n+=1
  return n*int(prize[-1])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  n = 0
  m = 0 # total prize money
  for i in range(len(prizes)):
    for j in range(len(prizes[i])):
            if lot == prizes[i][j]:
                n+=1
                m+=n*int(prizes[i][-1])
                n=0
  return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  if int(lot) == (int(prize[0])-1) or int(lot) == (int(prize[0])+1) or abs(int(lot)-int(prize[0])) ==999999 :
    return int(prize[-1])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  first = lot[0:3]
  for i in range(len(prize)):
    if first == prize[i]:
      return int(prize[-1])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  last1 = lot[-2:]
  last2 = lot[-3:]
  for i in range(len(prize)):
    if last1 == prize[i]:
      return int(prize[-1])
    elif last2 == prize[i]:
      return int(prize[-1])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  first = lot[0:3]
  last1 = lot[-2:]
  last2 = lot[-3:]
  m = 0
  for i in range(len(prizes)):
    for j in range(len(prizes[i])):
      if first == prizes[i][j]:
        m+= int(prizes[i][-1])
      elif last1 == prizes[i][j]:
        m+= int(prizes[i][-1])
      elif last2 == prizes[i][j]:
        m+= int(prizes[i][-1])
  return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  m =0
  if lot == (int(all_prizes[5][0])-1) or (int(all_prizes[5][0])+1):
    m= int(all_prizes[5][-1])
  return big_prizes (lot,all_prizes) +m+digit_prizes (lot,all_prizes)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6632191221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_20.0
[2951083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize0.0
[18460035]
bytecount: {'code': 792, 'const': 940, 'code+const': 1732}
def prize_check (lot,prize):
        if lot in prize:
          count = prize.count(lot)
          result = prize[-1]*count
        else:
          result = 0
        return result
def big_prizes (lot,prizes):
  result = 0
  for b in prizes:
      if lot in b:
        counter = b.count(lot)
        result = 0
        result =result+ b[-1]*counter
  return result
def next_to_first (lot,prize):
    x = int(prize[0])
    y = int(lot)
    if y == x-1:
      result = prize[-1]
    elif y == x+1:
      result = prize[-1]
    else:
      result = 0
    return result
def first_digits_check(lot,prize):
    B1 = int(lot[:3])
    if str(B1) in prize:
      result = prize[-1]
    else:
      result = 0
    return result
def last_digits_check(lot,prize):
    B2 = int(lot[3:])
    B3 = int(lot[4:])
    result = 0
    if str(B2) in prize:
      result = prize[-1]
    elif str(B3) in prize:
      result = prize[-1]
    return result
def digit_prizes (lot,prizes):
    B2 = int(lot[3:])
    B3 = int(lot[4:])
    B1 = int(lot[:3])
    result = 0
    if str(B1) in prizes[0]:
      result =result+ prizes[0][-1]
    if str(B2) in prizes[1]:
      result =result+ prizes[1][-1]
    if str(B3) in prizes[2]:
      result =result+ prizes[2][-1]
    return result
def total_prize (lot,all_prizes):
  prizes = all_prizes[0:]
  B2= int(lot[3:])
  B3 = int(lot[4:])
  B1 = int(lot[:3])
  x = int(prizes[5][0])
  y = int(lot)
  result = 0
  if y == x+1:
      result =result+ 100000
  elif y == x-1:
      result =result+ 100000
  for b in prizes:
      if lot in b:
        counter = b.count(lot)
        result = result+ b[-1]*counter
  if str(B1) in prizes[6]:
        result = result+ prizes[6][-1]
  if str(B2) in prizes[7]:
        result = result+ prizes[7][-1]
  if str(B1) in prizes[8]:
        result = result+ prizes[8][-1]
  return result

6632220821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_20.0
[2951083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize0.0
[1860045]
bytecount: {'code': 802, 'const': 940, 'code+const': 1742}
def prize_check (lot,prize):
        if lot in prize:
          count = prize.count(lot)
          answer = prize[-1]*count
        else:
          answer = 0
        return answer
def big_prizes (lot,prizes):
  answer = 0
  for e in prizes:
      if lot in e:
        ct = e.count(lot)
        answer = 0
        answer += e[-1]*ct
  return answer
def next_to_first (lot,prize):
    check = int(prize[0])
    num = int(lot)
    if num == check+1:
      answer = prize[-1]
    else :
      if num == check-1:
        answer = prize[-1]
      else:
        answer = 0
    return answer
def first_digits_check(lot,prize):
    first3 = int(lot[:3])
    if str(first3) in prize:
      answer = prize[-1]
    else:
      answer = 0
    return answer
def last_digits_check(lot,prize):
    l3 = int(lot[3:])
    l2 = int(lot[4:])
    answer = 0
    if str(l3) in prize:
      answer = prize[-1]
    else :
      if str(l2) in prize:
        answer = prize[-1]
      else :
        pass
    return answer
def digit_prizes (lot,prizes):
    l3 = int(lot[3:])
    l2 = int(lot[4:])
    first3 = int(lot[:3])
    answer = 0
    if str(first3) in prizes[0]:
      answer += prizes[0][-1]
    if str(l3) in prizes[1]:
      answer += prizes[1][-1]
    if str(l2) in prizes[2]:
      answer += prizes[2][-1]
    return answer
def total_prize (lot,all_prizes):
  prizes = all_prizes[0:]
  l3 = int(lot[3:])
  l2 = int(lot[4:])
  first3 = int(lot[:3])
  check = int(prizes[5][0])
  num = int(lot)
  answer = 0
  if num == check+1:
      answer += 100000
  else :
    if num == check-1:
      answer += 100000
    else :
      pass
  for e in prizes:
      if lot in e:
        ct = e.count(lot)
        answer += e[-1]*ct
  if str(first3) in prizes[6]:
        answer += prizes[6][-1]
  if str(l3) in prizes[7]:
        answer += prizes[7][-1]
  if str(l2) in prizes[8]:
        answer += prizes[8][-1]
  return answer

6530157521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, 987, 987, 987, 987, None987, None987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 28142, 28142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 5829, 5829, 53]
test_digit_prizes_20.0
[0, 16911]
test_total_prize1.0
[186005]
bytecount: {'code': 642, 'const': 716, 'code+const': 1358}
def prize_check (lot,prize):
    a = 0
    for i in range(len(prize)-1) :
        if lot == prize[i] :
            a += prize[-1]
    return a
def big_prizes (lot,prizes):
    b = 0
    for j in range(len(prizes)) :
        if prize_check(lot,prizes[j]) > 0 :
            b += prize_check(lot,prizes[j])
    return b
def next_to_first (lot,prize):
    if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1 :
        return prize[-1]
def first_digits_check(lot,prize):
    intlot = int(lot)
    a = 0
    for i in range(len(prize)-1) :
        if intlot < 1000 :
            if 0 == int(prize[i]):
                a += prize[-1]
        else:
            if (intlot // 1000) == int(prize[i]) :
                a += prize[-1]
    return a
def last_digits_check(lot,prize):
    intlot = int(lot)
    a = 0
    for i in range(len(prize)-1) :
        if (intlot-int(prize[i]))%10 == 0 :
            a += prize[-1]
    if int(prize[0]) >= 100 :
        for i in range(len(prize)-1) :
            if (intlot-int(prize[i]))%100 == 0 :
                a += prize[-1]
    return a
def digit_prizes (lot,prizes):
    a = 0
    a += first_digits_check(lot,prizes[0])
    a += last_digits_check(lot,prizes[1])
    a += last_digits_check(lot,prizes[2])
    return a
def total_prize (lot,all_prizes):
    a = 0
    a += big_prizes (lot,all_prizes[:5])
    a += next_to_first (lot,all_prizes[5])
    a += digit_prizes (lot,all_prizes[6:])
    return a

6630008821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 1020, 'const': 968, 'code+const': 1988}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    #print(len(prize))
    totalALL = 0
    for a in range(len(prize) - 1):
        if lot == prize[a]:
            totalALL = totalALL + prize[-1]
    return totalALL
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    totalALL = 0
    for a in range(len(prizes)):
        for b in range(len(prizes[a]) - 1):
            if lot == prizes[a][b]:
                totalALL = totalALL + prizes[a][-1]
    return totalALL
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
        return prize[1]
    else:
        return 0
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    totalALL = 0
    for a in range(len(prize)-1):
        if lot[:3] == prize[a]:
            totalALL = totalALL + prize[-1]
    return totalALL
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    w = len(prize[0])
    totalALL = 0
    if w == 2:
        for a in range(len(prize)-1):
            if lot[3:-1] == prize[a]:
                totalALL = totalALL + prize[-1]
    if w == 3:
        for a in range(len(prizes)-1):
            if lot[2:-1] == prizes[a]:
                totalALL = totalALL + prizes[-1]
    return totalALL
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    totalALL = 0
    for a in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][a]:
            totalALL = totalALL + prizes[0][-1]
    for a in range(len(prizes[1])-1):
        if lot[2:-1] == prizes[1][a]:
            totalALL = totalALL + prizes[1][-1]
    for a in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][a]:
            totalALL = totalALL + prizes[2][-1]
    return totalALL
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    totalALL = 0
    for a in range(5):
        for b in range(len(all_prizes[a])-1):
            if lot == all_prizes[a][b]:
                totalALL = totalALL + all_prizes[a][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        totalALL = totalALL + all_prizes[5][1]
    for a in range(len(all_prizes[6])-1):
        if lot[:3] == all_prizes[6][a]:
            totalALL = totalALL + all_prizes[6][-1]
    for a in range(len(all_prizes[7])-1):
        if lot[2:-1] == all_prizes[7][a]:
            totalALL = totalALL + all_prizes[7][-1]
    for a in range(len(all_prizes[8])-1):
        if lot[3:-1] == all_prizes[8][a]:
            totalALL = totalALL + all_prizes[8][-1]
    return totalALL

6630032821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 1020, 'const': 968, 'code+const': 1988}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    #print(len(prize))
    xxx = 0
    for i in range(len(prize) - 1):
        if lot == prize[i]:
            xxx = xxx + prize[-1]
    return xxx
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    xxx = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i]) - 1):
            if lot == prizes[i][j]:
                xxx = xxx + prizes[i][-1]
    return xxx
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
        return prize[1]
    else:
        return 0
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    xxx = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
            xxx = xxx + prize[-1]
    return xxx
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    x = len(prize[0])
    xxx = 0
    if x == 2:
        for i in range(len(prize)-1):
            if lot[3:-1] == prize[i]:
                xxx = xxx + prize[-1]
    if x == 3:
        for i in range(len(prizes)-1):
            if lot[2:-1] == prizes[i]:
                xxx = xxx + prizes[-1]
    return xxx
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    xxx = 0
    for i in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][i]:
            xxx = xxx + prizes[0][-1]
    for i in range(len(prizes[1])-1):
        if lot[2:-1] == prizes[1][i]:
            xxx = xxx + prizes[1][-1]
    for i in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][i]:
            xxx = xxx + prizes[2][-1]
    return xxx
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    xxx = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1):
            if lot == all_prizes[i][j]:
                xxx = xxx + all_prizes[i][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        xxx = xxx + all_prizes[5][1]
    for i in range(len(all_prizes[6])-1):
        if lot[:3] == all_prizes[6][i]:
            xxx = xxx + all_prizes[6][-1]
    for i in range(len(all_prizes[7])-1):
        if lot[2:-1] == all_prizes[7][i]:
            xxx = xxx + all_prizes[7][-1]
    for i in range(len(all_prizes[8])-1):
        if lot[3:-1] == all_prizes[8][i]:
            xxx = xxx + all_prizes[8][-1]
    return xxx

6630056921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 648, 'const': 688, 'code+const': 1336}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for i in prize:
        if lot == i:
            sum += prize[-1]
    return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for prize in prizes:
        for j in prize:
            if lot == j:
                sum += prize[-1]
    return sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    int_lot = int(lot)
    int_prize = int(prize[0])
    if int_lot == int_prize-1 or int_lot == int_prize+1:
        return prize[1]
    else:
        return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for i in prize:
        if lot[:3] == i:
            sum += prize[-1]
    return sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    sum = 0
    if len(prize[0]) == 2:
        for i in prize:
            if lot[3:-1] == i:
                sum += prize[-1]
    if len(prize[0]) == 3:
        for i in prize:
            if lot[2:-1] == i:
                sum += prizes[-1]
    return sum
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for i in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][i]:
            sum += prizes[0][-1]
    for i in range(len(prizes[1])-1):
        if lot[2:-1] == prizes[1][i]:
            sum += prizes[1][-1]
    for i in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][i]:
            sum += prizes[2][-1]
    return sum
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    sum = 0
    sum += big_prizes(lot,all_prizes[:5])
    sum += next_to_first(lot,all_prizes[5])
    sum += digit_prizes (lot,all_prizes[6:])
    return sum

6630060321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, 987, 987, 987, 987, None987, None987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 408, 'const': 552, 'code+const': 960}
def prize_check (lot,prize):
  total=0
  for i in prize[:-1]:
    if lot == i:
      total+=prize[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  total = 0
  for i in prizes:
    for j in i[:-1]:
      if lot==j:
        total += i[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  if int(lot) in [int(prize[0])-1,int(prize[0])+1]:
    return prize[-1]
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  for i in prize[:-1]:
    if lot.startswith(i):
      return prize[-1]
  return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  for i in prize[:-1]:
    if lot.endswith(i):
      return prize[-1]
  return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5])+digit_prizes (lot,all_prizes[6:])+ next_to_first(lot,all_prizes[5])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630062621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 142, 213, 4213]
test_last_digits_check_20.0
[710, 710, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 990, 'const': 1408, 'code+const': 2398}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total_money = 0
        for i in prize[:-1]:
         if lot in i:
          total_money += prize[-1]
        return total_money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        big_prizes_total = 0
        for i in prizes:
          for j in i[:-1]:
            if lot in j:
              big_prizes_total += i[-1]
        return big_prizes_total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        next_to_total = 0
        for i in prize[:-1]:
          if i == "000000":
                if lot == "000001" or lot == "999999":
                        next_to_total += 100000
          elif i == "999999":
                if lot == "000000" or lot == "999998":
                        next_to_total += 100000
          elif lot == str(int(i)+1) or lot == str(int(i)-1):
                next_to_total += 100000
        return next_to_total
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        first_digits_total = 0
        for i in prize[:-1]:
         if lot[0:3] in i:
          first_digits_total += prize[-1]
        return first_digits_total
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        last_digits_total = 0
        for i in prize[:-1]:
         if lot[3:] or lot[4:] in i:
                last_digits_total += prize[-1]
        return last_digits_total
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        first_digits_total = 0
        for i in prizes[0][:-1]:
         if lot[0:3] in i:
          first_digits_total += prizes[0][-1]
        last_digits_total = 0
        for i in prizes[1][:-1]:
         if lot[3:] in i:
                last_digits_total += prizes[1][-1]
        for i in prizes[2][:-1]:
         if lot[4:] in i:
                last_digits_total += prizes[2][-1]
        return last_digits_total + first_digits_total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        big_prizes_total = 0
        for i in all_prizes[:5]:
          for j in i[:-1]:
            if lot in j:
              big_prizes_total += i[-1]
        next_to_total = 0
        for i in all_prizes[5][:-1]:
          if i == "000000":
                if lot == "000001" or lot == "999999":
                        next_to_total += 100000
          elif i == "999999":
                if lot == "000000" or lot == "999998":
                        next_to_total += 100000
          elif lot == str(int(i)+1) or lot == str(int(i)-1):
                next_to_total += 100000
        first_digits_total = 0
        for i in all_prizes[6][:-1]:
         if lot[0:3] in i:
          first_digits_total += all_prizes[6][-1]
        last_digits_total = 0
        for i in all_prizes[7][:-1]:
         if lot[3:] in i:
                last_digits_total += all_prizes[7][-1]
        for i in all_prizes[8][:-1]:
         if lot[4:] in i:
                last_digits_total += all_prizes[8][-1]
        return big_prizes_total + first_digits_total + last_digits_total + next_to_total

6630065521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_10.0
[None0, 71, 71]
test_first_digits_check_20.0
[None0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0TypeError("unsupported operand type(s) for +=: 'int' and 'NoneType'")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0TypeError("unsupported operand type(s) for +=: 'int' and 'NoneType'")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 502, 'const': 552, 'code+const': 1054}
def prize_check(lot,prize):
    if lot in prize:
        return prize[-1]*prize.count(lot)
    else:
        return 0
def big_prizes(lot,prizes):
    sum=0
    for i in range(len(prizes)):
        sum+=prize_check(lot,prizes[i])
    return sum
def next_to_first(lot,prize):
    if lot==str(int(prize[0])-1) or lot==str(int(prize[0])+1):
        return prize[-1]*prize.count(prize[0])
    else: return 0
def first_digits_check(lot,prize):
    if lot[:3] in prize:
        return prize[-1]*prize.count(lot[:3])
def last_digits_check(lot,prize):
    if lot[3:] in prize:
        return prize[-1]*prize.count(lot[3:])
    if lot[4:] in prize:
        return prize[-1]*prize.count(lot[4:])
    else:
        return 0
def digit_prizes(lot,prizes):
    sum=0
    for i in range(len(prizes)):
        if i==0:
            sum+=first_digits_check(lot,prizes[i])
        else:
            sum+=last_digits_check(lot,prizes[i])
    return sum
def total_prize (lot,all_prizes):
    sum=0
    sum+=big_prizes(lot,all_prizes[:5])
    sum+=next_to_first(lot,all_prizes[5])
    sum+=digit_prizes(lot,all_prizes[6:])
    return sum

6630075821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 448, 'const': 644, 'code+const': 1092}
def prize_check(lot, prize):
    total_prize = 0
    for i in range(len(prize) - 1):
      if lot == prize[i]:
          total_prize += int(prize[-1])
    return total_prize
def big_prizes(lot, prizes):
    total_prize = 0
    for i in range(5):
        total_prize += prize_check(lot, prizes[i])
    return total_prize
def next_to_first(lot, prizes):
    return prize_check(lot, prizes)
def first_digits_check(lot, prizes):
    return prize_check(lot[:3], prizes)
def last_digits_check(lot, prizes):
    return prize_check(lot[4:], prizes)
def digit_prizes(lot, prizes):
    check_first_digit = prize_check(lot[:3], prizes[0])
    check_first_digit2 = prize_check(lot[:3], prizes[1])
    check_last_digit = prize_check(lot[4:], prizes[2])
    return check_first_digit + check_first_digit2 + check_last_digit
def total_prize(lot, all_prizes):
    total = 0
    prize_check1 = prize_check(lot,all_prizes[0])
    prize_check2 = prize_check(lot,all_prizes[1])
    prize_check3 = prize_check(lot,all_prizes[2])
    prize_check4 = prize_check(lot,all_prizes[3])
    prize_check5 = prize_check(lot,all_prizes[4])
    next_num = next_to_first(lot,all_prizes[5])
    num_prize = digit_prizes(lot,all_prizes[6:])
    total = prize_check1 + prize_check2 + prize_check3 + prize_check4 + prize_check5 + next_num + num_prize
    return total

6630078721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 768, 'const': 884, 'code+const': 1652}
def prize_check (lot,prize):
    money = 0
    for i in range(len(prize)-1):
        if lot == prize[i] :
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
    money = 0
    for i in range(5):
        for j in range(len(all_prizes[i])):
            if lot == prizes[i][j]:
                money += all_prizes[i][-1]
    return money
def next_to_first (lot,prize):
         money = 0
         pr = []
         pr += [(int(all_prizes[0][0])+1)]
         pr += [(int(all_prizes[0][0])-1)]
         for i in range(len(pr)):
             if int(lot) == pr[i]:
                 money += prize[1]
         return money
def first_digits_check(lot,prize):
    money = 0
    for i in range(len(prize)-1):
        if prize[i] in lot[0:3]:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    for i in range(len(prize)-1):
        if len(prize[i]) == 3 :
            if prize[i] in lot[-3:]:
                money += prize[-1]
        elif len(prize[i]) == 2 :
            if prize[i] in lot[-2:]:
                money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    money = 0
    for i in range(len(prizes)):
        for j in range(len((prizes)[i])-1):
            if len((prizes)[i][j]) == 3:
                if i == 0 :
                    if prizes[i][j] in lot[0:3] :
                        money += prizes[i][-1]
                elif i == 1 :
                    if prizes[i][j] in lot[-3:]:
                        money += prizes[i][-1]
            else :
                if prizes[i][j] in lot[-2:]:
                    money += prizes[i][-1]
    return money
def total_prize (lot,all_prizes):
    money = 0
    money = big_prizes (lot,all_prizes[:5])+next_to_first (lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
    return money

6630079321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, 987, 987, 987, 987, None987, None987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 408, 'const': 552, 'code+const': 960}
def prize_check (lot,prize):
  total=0
  for x in prize[:-1]:
    if lot == x:
      total+=prize[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  total = 0
  for x in prizes:
    for j in x[:-1]:
      if lot==j:
        total += x[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  if int(lot) in [int(prize[0])-1,int(prize[0])+1]:
    return prize[-1]
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  for x in prize[:-1]:
    if lot.startswith(x):
      return prize[-1]
  return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  for x in prize[:-1]:
    if lot.endswith(x):
      return prize[-1]
  return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
   return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
   return big_prizes(lot,all_prizes[:5])+digit_prizes (lot,all_prizes[6:])+ next_to_first(lot,all_prizes[5])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630311921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[710, 71, 71]
test_first_digits_check_20.0
[710, 7142, 7142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1016, 'const': 1408, 'code+const': 2424}
def prize_check(lot,prize):
  k=0
  for i in range(len(prize)-1) :
      if lot==prize[i]:
        k+=int(prize[-1])
  return k
def big_prizes(lot,prize):
  k=0
  for i in range(len(prize)):
      m=prize[i]
      for x in range(len(m)-1):
          if lot == m[x]:
             k+=m[-1]
  return k
def   next_to_first(lot,prize):
   if int(lot)==int(prize[0])-1 or int(lot)==int(prize[0])+1:
     return prize[-1]
   elif prize[0]=='000000' and lot=='000001' :
     return prize[-1]
   elif prize[0]=='000000' and lot=='999999' :
     return prize[-1]
   elif prize[0]=='999999' and lot=='999998' :
     return prize[-1]
   elif prize[0]=='999999' and lot=='000000' :
     return prize[-1]
   else :
     return 0
def first_digits_check(lot,prize):
  k=0
  for i in range(len(prize)-1) :
    if lot[3:]==prize[i]:
      k+=prize[-1]
  return k
def last_digits_check(lot,prize):
  k=0
  for i in range(len(prize)-1) :
      if prize==all_prizes[7]and lot[3:]==prize[i]:
       k+=int(prize[-1])
      elif prize==all_prizes[8] and lot[4:]==prize[i]:
       k+=int(prize[-1])
  return k
def digit_prizes(lot,prize):
  k=0
  for i in range(len(prize)) :
      m=prize[i]
      for z in range(len(m)-1):
        if lot[3:]==m[z] or lot[4:]==m[z]:
          k+=m[-1]
  return k
def total_prize(lot,prize):
  k=0
  for i in range (len(prize)):
      s=prize[i]
      for j in range(len(s)-1):
        if i!=5:
           if lot==s[j]:
              k+=s[-1]
           if lot[3:]==s[j]:
              k+=s[-1]
           if lot[4:]==s[j]:
              k+=s[-1]
        if i==5:
            if int(lot)==int(s[0])-1 or int(lot)==int(s[0])+1:
                k+= s[-1]
            if s[0]=='000000' and lot=='000001' :
                k+= s[-1]
            if s[0]=='000000' and lot=='999999' :
                k+= s[-1]
            if s[0]=='999999' and lot=='999998' :
                k+= s[-1]
            if s[0]=='999999' and lot=='000000' :
                 k+= s[-1]
  return k

6630316021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 634, 'const': 996, 'code+const': 1630}
def prize_check (lot,prize):
  c=0
  for i in range(len(prize)):
   if lot == prize[i]:
     c+=1
  return prize[-1]*c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  b=0
  for i in range(len(prizes)):
    b+=prize_check(lot,prizes[i])
  return b
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  p1=all_prizes[0][0]
  if p1 !="000000"or p1!="999999":
    np1=str(int(p1)-1)
    np2=str(int(p1)+1)
  elif p1 == "000000":
    np1=="999999"
    np2=="000001"
  elif p1=="999999":
    np1=="999998"
    np2=="000000"
  if lot == np1 or np2:
    return prize[-1]
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  f3=lot[:3]
  c=0
  for i in range(len(prize)):
    if f3 == prize[i]:
      c+=1
  return prize[-1]*c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  l2=lot[-2:]
  l3=lot[-3:]
  c=0
  if l2 in prize:
    c+=prize[-1]
  if l3 in prize:
    c+=prize[-1]
  return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  f3=lot[:3]
  l3=lot[-3:]
  l2=lot[-2:]
  c=0
  if f3 in prizes[0]:
    c+=prizes[0][-1]
  if l3 in prizes[1]:
    c+=prizes[1][-1]
  if l2 in prizes[2]:
    c+=prizes[2][-1]
  return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  b=big_prizes(lot,all_prizes[:5])
  NP=next_to_first(lot,all_prizes[5])
  d=digit_prizes(lot,all_prizes[6:])
  return b+NP+d
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630329221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0
[18460045]
bytecount: {'code': 624, 'const': 824, 'code+const': 1448}
def prize_check (lot,prize):
  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
  # คืนผลรวมของเงินรางวัลที่ได้
  sum = 0
  for n in prize[:-1]:
    if lot == n:
       sum += int(prize[-1])
  return sum
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for prize in prizes:
      sum += prize_check (lot,prize)
    return sum
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    sum = 0
    next = []
    lottery,p = prize
    if lottery == '999999':
      next += ['999998','000000']
    elif lottery == '000000':
      next += ['999999','000001']
    else:
      next += [str(int(lottery)-1),str(int(lottery)+1)]
      for n in next:
        if lot == n:
          sum += p
    return sum
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for n in prize[:-1]:
      if lot[:3] == n:
        sum += prize[-1]
    return sum
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    sum = 0
    for n in prize[:-1]:
      if len(n) == 3:
        if lot[-3] == n:
          sum += prize[-1]
      elif len(n) == 2:
        if lot[-2:] == n:
          sum += prize[-1]
      else:
        pass
      return sum
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for i in range(len(prizes)):
      if i == 0:
        sum += first_digits_check(lot,prizes[i])
      else:
        sum += last_digits_check(lot,prizes[i])
      return sum
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    sum = 0
    sum += big_prizes(lot,all_prizes[:5])
    sum += next_to_first(lot,all_prizes[5])
    sum += digit_prizes (lot,all_prizes[6:])
    return sum

6631015321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 440, 'const': 632, 'code+const': 1072}
def prize_check(lot, prize):
    total_prize = 0
    for p in prize[:-1]:
        if lot == p:
          total_prize = total_prize + prize[-1]
    return total_prize
def big_prizes(lot, prizes):
    total_prize = 0
    for prize_list in prizes:
        total_prize += prize_check(lot, prize_list)
    return total_prize
def next_to_first(lot, prize):
    total_prize = 0
    adjacent_lots = [str(int(lot) + i) for i in [-1, 1]]
    for adjacent_lot in adjacent_lots:
        total_prize += prize_check(adjacent_lot, prize)
    return total_prize
def first_digits_check(lot, prize):
    total_prize = 0
    if lot[0:3] in prize:
        return prize[-1]
    else:
        return 0
def last_digits_check(lot, prize):
    total_prize = 0
    if lot[4:6] in prize:
        total_prize += prize[-1]
    return total_prize
def digit_prizes(lot, prizes):
    total_prize = 0
    for p in prizes:
        if len(p) == 3:
            total_prize += first_digits_check(lot, p)
        elif len(p) == 2:
            total_prize += last_digits_check(lot, p)
    return total_prize
def total_prize(lot, all_prizes):
    total = 0
    total += digit_prizes(lot, all_prizes[6:])+big_prizes(lot, all_prizes[0:5])+next_to_first(lot, all_prizes[5])
    return total

6631109721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, '111'42, '1456'2]
test_last_digits_check_10.0
[0, None142, None142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 692, 'const': 992, 'code+const': 1684}
def prize_check (lot,prize):
    p = 0
    for i in range(len(prize)):
      if lot == prize[i]:
        p += prize[-1]
    return p
def big_prizes(lot,prizes):
    p = 0
    for i in range(5):
        p += prize_check(lot,prizes[i])
    return p
def next_to_first (lot,prize):
    p = 0
    if prize[0] == "999999":
        nf1 = "000000"
        nf2 = "999998"
    elif prize[0] == "000000":
        nf1 = "000001"
        nf2 = "999999"
    else:
        nf1 = str(int(prize[0]) - 1)
        nf2 = str(int(prize[0]) + 1)
    if lot == nf1 or lot == nf2 :
        p += prize[-1]
    return p
def first_digits_check(lot,prize):
    if lot[:3] == prize[0] or lot[:3] == prize[1]:
        return prize[2]
    else:
        return 0
def last_digits_check(lot,prize):
    if len(prize) == 3:
        if lot[3:] == prize[0] or lot[3:] == prize[1]:
            return prize[2]
        else:
            return 0
    elif len(prize) == 2:
        if lot[4:] == prize[0]:
            return prize[1]
        else:
            return 0
def digit_prizes (lot,prizes):
    p = 0
    if lot[3:] == prizes[0][0] or lot[3:] == prizes[0][1]:
        p += prizes[0][2]
    if lot[3:] == prizes[1][0] or lot[3:] == prizes[1][1]:
        p += prizes[1][2]
    if lot[4:] == prizes[2][0]:
        p += prizes[2][1]
    return p
def total_prize(lot,all_prizes):
    p = 0
    p += big_prizes(lot,all_prizes[:5])
    p += next_to_first(lot,all_prizes[5])
    p += digit_prizes(lot,all_prizes[6:])
    return p

6631122821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 460, 'const': 644, 'code+const': 1104}
def prize_check (lot,prize):
  prize_total = 0
  for i in range(len(prize) - 1):
    if lot == prize[i]:
      prize_total += int(prize[-1])
  return prize_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  prize_total = 0
  for i in range(5):
    prize_total += prize_check(lot, prizes[i])
  return prize_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  prize_total = prize_check(lot,prize)
  return prize_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  prize_total = prize_check(lot[:3],prize)
  return prize_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  prize_total = prize_check(lot[4:],prize)
  return prize_total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  firstdigitcheck1 = prize_check(lot[:3],prizes[0])
  firstdigitcheck2 = prize_check(lot[:3],prizes[1])
  lastdigitcheck = prize_check(lot[4:],prizes[2])
  return firstdigitcheck1 + firstdigitcheck2 + lastdigitcheck
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  total = 0
  check_1 = prize_check(lot,all_prizes[0])
  check_2 = prize_check(lot,all_prizes[1])
  check_3 = prize_check(lot,all_prizes[2])
  check_4 = prize_check(lot,all_prizes[3])
  check_5 = prize_check(lot,all_prizes[4])
  next_num = next_to_first(lot,all_prizes[5])
  digit_num = digit_prizes(lot,all_prizes[6:])
  total = check_1 + check_2 + check_3 + check_4 + check_5 + next_num + digit_num
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631205221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 856, 'const': 828, 'code+const': 1684}
def prize_check(a,prize):         #ตรวจรางวัลที่1-5 ทีละตัว
    total=0
    for i in range(len(prize)):
        if a==prize[i]:
            total   +=  prize[-1]
    return total
def big_prizes(a,prizes):          #ตรวจรางวัลที่1-5 ทุกตัว
    total=0
    for i in range(len(prizes)):
        j=  0
        while j  <  len(prizes[i]):
            if a ==  prizes[i][j]:
                total   +=   prizes[i][-1]
            j +=1
    return total
def next_to_first(a,prize):      #ฟังก์ชันตรวจรางวัลข้างเคียงรางวัลที่1
    total = 0
    for i in range(len(prize)):
        if a == prize[i]:
            total += prize[-1]
    return total
def first_digits_check(a,prize):  #ฟังก์ชันตรวจรางวัลเลขหน้า3ตัว
    total =  0
    lot_1st_digits =  a[:3]
    for i in range(len(prize)):
        if lot_1st_digits == prize[i]:
            total += prize[-1]
    return total
def last_digits_check(a,prize):  #ฟังก์ชันตรวจรางวัลเลขท้าย3ตัวและ2ตัว
    total= 0
    lot_last_3digits  = a[4:]
    lot_last_2digits =  a[5:]
    for i in range(len(prize)):
        if lot_last_3digits == prize[i]:
            total +=  prize[-1]
        elif lot_last_2digits  ==  prize[i]:
            total  +=  prize[-1]
    return total
def digit_prizes(a,prizes):       #ฟังก์ชันตรวจรางวัลเลขหน้า3ตัว เลขท้าย3ตัวและ2ตัว
    total= 0
    lot_1st_digits =   a[:3]
    lot_last_3digits =  a[4:]
    lot_last_2digits =  a[5:]
    for i in range(len(prizes)):
        j  = 0
        while j in range(len(prizes[i])):
            if lot_1st_digits == prizes[i][j]:
                total += prizes[i][-1]
            if lot_last_3digits == prizes[i][j]:
                total  += prizes[i][-1]
            if lot_last_2digits == prizes[i][j]:
                total  +=  prizes[i][-1]
            j += 1
    return total
def total_prize(a,all_prizes):       #ฟังก์ชันตรวจรางวัลทุกตัว
    total= 0
    for i in range(len(all_prizes)):
        j= 0
        while j<len(all_prizes[i]):
            if a == all_prizes[i][j]:
                total += all_prizes[i][-1]
            if a[:3] == all_prizes[i][j]:
                total += all_prizes[i][-1]
            if a[4:] == all_prizes[i][j]:
                total += all_prizes[i][-1]
            if a[5:] == all_prizes[i][j]:
                total += all_prizes[i][-1]
            j += 1
    return total

6631220621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0IndexError('list index out of range')
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0IndexError('list index out of range')
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 834, 'const': 800, 'code+const': 1634}
def prize_check (lot,all_prizes):
  calculate = []
  for i in all_prizes:
    if lot == i :
      first = all_prizes
      got = first[-1]
      calculate.append(got)
    else:
      calculate.append(0)
  return (sum(calculate))
def big_prizes (lot,all_prizes):
  calculate = []
  for i in range(0,5):
    p = len(all_prizes[i])
    for h in range(0,p):
      t = all_prizes[i]
      if lot == t[h] :
        first = all_prizes[i]
        got = first[-1]
        calculate.append(got)
  return (sum(calculate))
def next_to_first (lot,all_prizes):
  calculate = []
  for i in all_prizes:
    if lot == i :
      first = all_prizes
      got = first[-1]
      calculate.append(got)
    else:
      calculate.append(0)
  return (sum(calculate))
def first_digits_check (lot,all_prizes):
  l = str(int(lot)//1000)
  calculate = []
  for i in all_prizes:
    if l == i :
      first = all_prizes
      got = first[-1]
      calculate.append(got)
    else:
      calculate.append(0)
  return (sum(calculate))
def last_digits_check (lot,all_prizes):
  T = str(int(lot) %1000)
  L = str(int(lot) %100)
  calculate = []
  for i in all_prizes:
    if T == i or L == i:
      first = all_prizes
      got = first[-1]
      calculate.append(got)
    else:
      calculate.append(0)
  return (sum(calculate))
def digit_prizes(lot,all_prizes):
  l = str(int(lot) //1000)
  T = str(int(lot) %1000)
  L = str(int(lot) %100)
  calculate = []
  for i in range(6,9):
    p = len(all_prizes[i])
    for h in range(0,p):
      t = all_prizes[i]
      if l == t[h] or T == t[h] or L == t[h]:
        first = all_prizes[i]
        got = first[-1]
        calculate.append(got)
  return (sum(calculate))
def total_prize(lot,all_prizes):
  l = str(int(lot) //1000)
  T = str(int(lot) %1000)
  L = str(int(lot) %100)
  calculate = []
  for i in range(0,9):
    p = len(all_prizes[i])
    for h in range(0,p):
      t = all_prizes[i]
      if lot == t[h] or l == t[h] or T == t[h] or L == t[h]:
        first = all_prizes[i]
        got = first[-1]
        calculate.append(got)
  return (sum(calculate))

6631226421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'total_prize' is not defined")
[186005]
bytecount: {'code': 856, 'const': 828, 'code+const': 1684}
def prize_check (lot,prizes):   #ฟังก์ชันตรวจรางวัลที่1-5 ทีละตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    total=0
    for i in range(len(prizes)):
        if lot==prizes[i]:
            total +=prizes[-1]
    return total
def big_prizes (lot,prizes):  #ฟังก์ชันตรวจรางวัลที่1-5 ทุกตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    total=0
    for i in range(len(prizes)):
        j=0
        while j<len(prizes[i]):
            if lot==prizes[i][j]:
                total += prizes[i][-1]
            j +=1
    return total
def next_to_first (lot,prize):  #ฟังก์ชันตรวจรางวัลข้างเคียงรางวัลที่1
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    total=0
    for i in range(len(prize)):
        if lot==prize[i]:
            total +=prize[-1]
    return total
def first_digits_check(lot,prize):  #ฟังก์ชันตรวจรางวัลเลขหน้า3ตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    total=0
    lot_1st_digits = lot[:3]
    for i in range(len(prize)):
        if lot_1st_digits==prize[i]:
            total +=prize[-1]
    return total
def last_digits_check(lot,prize): #ฟังก์ชันตรวจรางวัลเลขท้าย3ตัวและ2ตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    total=0
    lot_last_3digits = lot[4:]
    lot_last_2digits = lot[5:]
    for i in range(len(prize)):
        if lot_last_3digits==prize[i]:
            total +=prize[-1]
        elif lot_last_2digits==prize[i]:
            total += prize[-1]
    return total
def digit_prizes (lot,prizes):   #ฟังก์ชันตรวจรางวัลเลขหน้า3ตัว เลขท้าย3ตัวและ2ตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    total=0
    lot_1st_digits = lot[:3]
    lot_last_3digits = lot[4:]
    lot_last_2digits = lot[5:]
    for i in range(len(prizes)):
        j=0
        while j in range(len(prizes[i])):
            if lot_1st_digits==prizes[i][j]:
                total +=prizes[i][-1]
            if lot_last_3digits==prizes[i][j]:
                total +=prizes[i][-1]
            if lot_last_2digits==prizes[i][j]:
                total += prizes[i][-1]
            j+=1
    return total
def total_prizes (lot,all_prizes): #ฟังก์ชันตรวจรางวัลทุกตัว
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    total=0
    for i in range(len(all_prizes)):
        j=0
        while j<len(all_prizes[i]):
            if lot==all_prizes[i][j]:
                total += all_prizes[i][-1]
            if lot[:3]==all_prizes[i][j]:
                total+=all_prizes[i][-1]
            if lot[4:]==all_prizes[i][j]:
                total+=all_prizes[i][-1]
            if lot[5:]==all_prizes[i][j]:
                total+=all_prizes[i][-1]
            j +=1
    return total
    all_prizes = [['555556',6000000],['111111','222222',200000],['333333','444444','666666',80000],['555555','555555','7777777','888888',40000],
                  ['000001','000002','000003','000004','000005','000006',20000],['555555','555557',100000],['555','666',4000],['777','888',4000],['55',2000]]

6631504921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 940, 'const': 996, 'code+const': 1936}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    #m = money prize check
    m = 0
    for x in range(len(prize)):
        if lot == prize[x-1]:
            m += prize[-1]
    return m
def big_prizes (lot,prizes):
    #t = total big prize
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    t = 0
    for x in range(len(prizes)):
        for y in range(len(prizes[x])):
            if lot == prizes[x][y]:
                t += prizes[x][-1]
    return t
def next_to_first(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    #n = next_to_first
    #mn = money_next_to_first
    n = [int(prize[0])-1, int(prize[0])+1]
    mn = 0
    if int(lot) in n:
        mn += prize[-1]
    return mn
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    #c = check_lot
    #f = first_digits_check
    #mf = money_first_digits_check
    c = lot[:3]
    mf = 0
    for x in range(len(prize)):
        if c == prize[x-1]:
            mf += prize[-1]
    return mf
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    a = len(prize[0])
    b = 0
    if a == 2:
        for x in range(len(prize)-1):
            if lot[3:-1] == prize[x]:
                b = b + prize[-1]
    if a == 3:
        for x in range(len(prizes)-1):
            if lot[2:-1] == prizes[x]:
                b = b + prizes[-1]
    return b
def digit_prizes(lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    #cll = check_lot_list
    #td = total_digit_prizes
    cll = [lot[:3], lot[-4:-1], lot[-3:-1]]
    td = 0
    for x in range(len(prizes)):
        for y in range(len(prizes[x])):
            if cll[x] == prizes[x][y-1]:
                td += prizes[x][-1]
    return td
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    b = 0
    for x in range(5):
        for y in range(len(all_prizes[x])-1):
            if lot == all_prizes[x][y]:
                b = b + all_prizes[x][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        b = b + all_prizes[5][1]
    for x in range(len(all_prizes[6])-1):
        if lot[:3] == all_prizes[6][x]:
            b = b + all_prizes[6][-1]
    for x in range(len(all_prizes[7])-1):
        if lot[2:-1] == all_prizes[7][x]:
            b = b + all_prizes[7][-1]
    for x in range(len(all_prizes[8])-1):
        if lot[3:-1] == all_prizes[8][x]:
            b = b + all_prizes[8][-1]
    return b

6631510621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize0.0
[18460045]
bytecount: {'code': 606, 'const': 769, 'code+const': 1375}
def prize_check (lot,prize):
  total_prize = 0
  for number in prize[:-1]:
    if lot == number:
      total_prize +=  int(prize[-1])
  return total_prize
def big_prizes (lot,prizes):
  total_prize = 0
  for prize in prizes:
    total_prize += prize_check(lot, prize)
  return total_prize
def next_to_first (lot,prize):
  total_prize = 0
  next_to = []
  first,pz = prize
  if first == '000000':
    next_to += ['999999', '000001']
  elif first == '999999':
    next_to += ['999999', '000000']
  else:
    next_to += [str(int(first)-1), str(int(first)+1)]
  for number in next_to:
    if lot == number:
      total_prize += pz
  return total_prize
def first_digits_check(lot,prize):
  total_prize = 0
  for number in prize[:-1]:
    if lot[:3] == number:
      total_prize += prize[-1]
  return total_prize
def last_digits_check(lot,prize):
  total_prize = 0
  for number in prize[:-1]:
    if len(number) == 3:
      if lot[-3:] == number:
        total_prize += prize[-1]
      elif len(number) == 2:
        if lot[-2:] == number:
          total_prize += prize[-1]
      else:
        pass
  return total_prize
def digit_prizes (lot,prizes):
  total_prize = 0
  for i in range(len(prizes)):
    if i == 0:
      total_prize += first_digits_check(lot, prizes[i])
    else:
      total_prize += last_digits_check(lot, prizes[i])
    return total_prize
def total_prize (lot,all_prizes):
  total_prize = 0
  total_prize += big_prizes(lot, all_prizes[:5])
  total_prize += next_to_first(lot, all_prizes[5])
  total_prize += digit_prizes(lot, all_prizes[6:])
  return total_prize

6631515821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 1024, 'const': 968, 'code+const': 1992}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for c in range(len(prize)):
        if lot == prize[c-1]:
            x += prize[-1]
    return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for c in range(len(prizes)):
        for d in range(len(prizes[c])):
            if lot == prizes[c][d-1]:
                x += prizes[c][-1]
    return x
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
          return prize[1]
        else:
          return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for c in range(len(prize)):
        if lot[:3] == prize[c-1]:
            x += prize[-1]
    return x
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    x = 0
    if len(prize[0]) == 2:
        for c in range(len(prize)):
            if lot[3:-1] == prize[c-1]:
                x += prize[-1]
    if len(prize[0]) == 3:
        for c in range(len(prizes)):
            if lot[2:-1] == prizes[c-1]:
                x += prizes[-1]
    return x
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for c in range(len(prizes[0])):
        if lot[:3] == prizes[0][c-1]:
            x += prizes[0][-1]
    for c in range(len(prizes[1])):
        if lot[2:-1] == prizes[1][c-1]:
            x += prizes[1][-1]
    for c in range(len(prizes[2])):
        if lot[3:-1] == prizes[2][c-1]:
            x += prizes[2][-1]
    return x
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    x = 0
    for c in range(5):
        for d in range(len(all_prizes[c])):
            if lot == all_prizes[c][d-1]:
                x += all_prizes[c][-1]
    if lot == str(int(all_prizes[5][0])-1) or lot == str(int(all_prizes[5][0])+1):
        x += all_prizes[5][1]
    for c in range(len(all_prizes[6])):
        if lot[:3] == all_prizes[6][c-1]:
            x += all_prizes[6][-1]
    for c in range(len(all_prizes[7])):
        if lot[2:-1] == all_prizes[7][c-1]:
            x += all_prizes[7][-1]
    for c in range(len(all_prizes[8])):
        if lot[3:-1] == all_prizes[8][c-1]:
            x += all_prizes[8][-1]
    return x

6631529621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'digits_check' is not defined")
[186005]
bytecount: {'code': 540, 'const': 664, 'code+const': 1204}
def prize_check(lot, prize):
    total_prize = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            total_prize += prize[-1]
    return total_prize
def big_prizes(lot, prizes):
    total_prize = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i]) - 1):
            if lot == prizes[i][j]:
                total_prize += prizes[i][-1]
    return total_prize
def next_to_first(lot, prize):
    total_prize = 0
    for i in range(len(prize)-1):
       if lot == prize[i] or abs(int(lot) - int(prize[i])) == 1:
                total_prize += prize[-1]  # เพิ่มเงินรางวัลข้างเคียงลงในราคารวม
    return total_prize
def first_digits_check(lot,prize):
    total_prize = 0
    for i in range(len(prize) - 1):
        if lot[:3] == prize[i]:
            total_prize += prize[-1]
    return total_prize
def last_digits_check(lot,prize):
    total_prize = 0
    for i in range(len(prize) - 1):
        if lot[4:] == prize[i]:
            total_prize += prize[-1]
    return total_prize
def digit_prizes(lot,prizes):
    total_prize = 0
    for i in range(len(prizes)):
        total_prize += first_digits_check(lot,prizes[i])
        total_prize += last_digits_check(lot,prizes[i])
    return total_prize
def total_prize(lot, all_prizes):
    total_prize = big_prizes(lot,all_prizes[:5])
    total_prize += digits_check(lot,all_prizes[6:])
    total_prize += next_to_first(lot,all_prizes[5])
    return total_prize

6631540421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 29, 53]
test_digit_prizes_20.0
[0, 16911]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 796, 'code+const': 1344}
def prize_check (lot,prize):
   x = 0
   for num in prize[:-1]:
    if lot == num:
      x += int(prize[-1])
   return x
def big_prizes (lot,prizes):
    x = 0
    for prize in prizes:
      x += prize_check (lot,prize)
    return x
def next_to_first (lot,prize):
    x = 0
    next = []
    o,p = prize
    if o == '999999':
      next = ['000000','999998']
    elif o == '000000':
      next = ['000001','999999']
    else :
      next = [str(int(o)-1),str(int(o)+1)]
    for num in next :
      if lot == num:
        x += p
      return x
def first_digits_check(lot,prize):
    x=0
    for num in prize[:-1]:
      if num == lot[:3]:
        x += prize[-1]
    return x
def last_digits_check(lot,prize):
    x=0
    for num in prize[:-1]:
      if num == lot[3:6]:
        x += prize[-1]
      elif num == lot[4:6]:
        x += prize[-1]
      else :
        x = 0
    return x
def digit_prizes (lot,prizes):
       x = 0
       for i in prizes :
        fd = first_digits_check(lot,i)
        ld = last_digits_check(lot,i)
        x += fd
        x += ld
       return x
def total_prize (lot,all_prizes):
       all = 0
       all += big_prizes(lot,all_prizes[:5])
       all += next_to_first(lot,all_prizes[5])
       all += digit_prizes(lot,all_prizes[6:])
       return all

6631702821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[710883]
test_big_prizes_20.0
[710883]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 708, 'const': 964, 'code+const': 1672}
def prize_check (lot,prizes):
    money=0
    for i in range (len(prizes)-1):
        if lot == prizes[i]:
            money+=prizes[-1]
    return money
def big_prizes (lot,prizes):
    money=0
    for i in range (len(prizes)-1):
        for a in prizes[i]:
            if lot == a:
                money+=prizes[i][-1]
    return money
def next_to_first (lot,prize):
    money=0
    ans = []
    if prize[0] == '000000':
        ans.append('999999')
        ans.append('000001')
        ans.append(100000)
    elif prize[0] == '999999':
        ans.append('999998')
        ans.append('000000')
        ans.append(100000)
    else:
        ans.append(str(int(prize[0])+1))
        ans.append(str(int(prize[0])-1))
        ans.append(100000)
    for i in range(len(ans)-1):
        if lot == ans[i]:
            money += int(ans[-1])
    return money
def first_digits_check(lot,prize):
    money=0
    for i in range (len(prize)-1):
        if lot[:3] == prize[i]:
            money+=prize[-1]
    return money
def last_digits_check(lot,prize):
    money=0
    for i in range(len(prize)-1):
        if lot[-3:] == prize[i]:
            money+=prize[-1]
        elif lot[-2:] == prize[i]:
            money+=prize[-1]
    return money
def digit_prizes (lot,prizes):
    money=0
    for i in range(len(prizes)):
        if i==0:
            money+=first_digits_check(lot,prizes[i])
        else:
            money+=last_digits_check(lot,prizes[i])
    return money
def total_prize (lot,all_prizes):
    money=0
    money+= big_prizes(lot,all_prizes[:5])
    money+= next_to_first(lot,all_prizes[5])
    money+= digit_prizes(lot,all_prizes[6:])
    return money

6631803521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 1020, 'const': 968, 'code+const': 1988}
def prize_check (lot,prize) :
    s = 0
    for i in range(len(prize) - 1)  :
        if lot == prize[i]  :
            s += prize[-1]
    return s
def big_prizes (lot,prizes):
    s = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i]) - 1):
            if lot == prizes[i][j]:
                s += prizes[i][-1]
    return s
def next_to_first (lot,prize) :
    if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1) :
        return prize[1]
    else:
        return 0
def first_digits_check(lot,prize) :
    s = 0
    for i in range(len(prize)-1)  :
        if lot[:3] == prize[i]  :
            s += prize[-1]
    return s
def last_digits_check(lot,prize)  :
    x = len(prize[0])
    s = 0
    if x == 2 :
        for i in range(len(prize)-1)  :
            if lot[3:-1] == prize[i]  :
                s += prize[-1]
    if x == 3:
        for i in range(len(prizes)-1) :
            if lot[2:-1] == prizes[i] :
                s += prizes[-1]
    return s
def digit_prizes (lot,prizes) :
    s = 0
    for i in range(len(prizes[0])-1)  :
        if lot[:3] == prizes[0][i]  :
            s += prizes[0][-1]
    for i in range(len(prizes[1])-1)  :
        if lot[2:-1] == prizes[1][i]  :
            s += prizes[1][-1]
    for i in range(len(prizes[2])-1):
        if lot[3:-1] == prizes[2][i]:
            s += prizes[2][-1]
    return s
def total_prize (lot,all_prizes)  :
    s = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1)  :
            if lot == all_prizes[i][j]  :
                s += all_prizes[i][-1]
    if lot == str(int(all_prizes[5][0])+1) or lot == str(int(all_prizes[5][0])-1) :
        s += all_prizes[5][1]
    for i in range(len(all_prizes[6])-1)  :
        if lot[:3] == all_prizes[6][i]  :
            s += all_prizes[6][-1]
    for i in range(len(all_prizes[7])-1)  :
        if lot[2:-1] == all_prizes[7][i]  :
            s += all_prizes[7][-1]
    for i in range(len(all_prizes[8])-1)  :
        if lot[3:-1] == all_prizes[8][i]  :
            s += all_prizes[8][-1]
    return s

6631806421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 598, 'const': 804, 'code+const': 1402}
def prize_check (lot,prize):
    money_prize_check = 0
    for i in range(len(prize)):
        if lot == prize[i-1]:
            money_prize_check += prize[-1]
    return money_prize_check
def big_prizes (lot,prizes):
    total_big_prizes = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i])):
            if lot == prizes[i][j-1]:
                total_big_prizes += prizes[i][-1]
    return total_big_prizes
def next_to_first (lot,prize):
    next_to_first = [int(prize[0])-1, int(prize[0])+1]
    money_next_to_first = 0
    if int(lot) in next_to_first:
        money_next_to_first += prize[-1]
    return money_next_to_first
def first_digits_check(lot,prize):
    check_lot = lot[:3]
    money_first_digits_check = 0
    for i in range(len(prize)):
        if check_lot == prize[i-1]:
            money_first_digits_check += prize[-1]
    return money_first_digits_check
def last_digits_check(lot,prize):
    money_last_digits_check = 0
    check_lot_last3 = lot[-4:-1]
    check_lot_last2 = lot[-3:-1]
    for i in range(len(prize)):
        if check_lot_last2 == prize[i] or check_lot_last3 == prize[i]:
                money_last_digits_check += prize[-1]
    return money_last_digits_check
def digit_prizes (lot,prizes):
    check_lot_list = [lot[:3], lot[-4:-1],  lot[-3:-1]]
    total_digit_prizes = 0
    for i in range(len(prizes)):
        for j in range(len(prizes[i])):
            if check_lot_list[i] == prizes[i][j-1]:
                total_digit_prizes += prizes[i][-1]
    return total_digit_prizes
def total_prize (lot,all_prizes):
    total_total_prize = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
    return total_total_prize

6631808721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1100, 'const': 1108, 'code+const': 2208}
def prize_check(lot,prize):
    money1 = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            money1 = money1 + prize[-1]
        else:
            money1 = money1 + 0
    return money1
def big_prizes(lot,prizes):
    money2 = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1):
            if lot == all_prizes[i][j]:
                money2 = money2 + all_prizes[i][-1]
            else:
                money2 = money2 + 0
    return money2
def next_to_first(lot,prize):
    money3 = 0
    left = int(lot)-1
    right = int(lot)+1
    if str(left) in prize:
        money3 = money3 + prize[-1]
    elif str(right) in prize:
        money3 = money3 + prize[-1]
    else:
        money3 = money3 + 0
    return money3
def first_digits_check(lot,prize):
    money4 = 0
    for i in range(len(prize)-1):
        if lot[0:3] == prize[i]:
            money4 = money4 + prize[-1]
        else:
            money4 = money4 + 0
    return money4
def last_digits_check(lot,prize):
    money5 = 0
    for i in range(len(prize)-1):
        if lot[3:] == prize[i] or lot[4:] == prize[i]:
            money5 = money5 + prize[-1]
        else:
            money5 = money5 + 0
    return money5
def digit_prizes(lot,prizes):
    money6 = 0
    for i in range(2):
        for j in range(len(all_prizes[i+7])-1):
            if lot[3:] == all_prizes[i+7][j] or lot[4:] == all_prizes[i+7][j]:
                money6 = money6 + all_prizes[i+7][-1]
            else:
                money6 = money6 + 0
    for i in range(len(all_prizes[6])):
        if lot[0:3] == all_prizes[6][i]:
            money6 = money6 + all_prizes[6][-1]
        else:
            money6 = money6 + 0
    return money6
def total_prize (lot,all_prizes):
    summoney = 0
    money1 = 0
    for i in range(5):
        for j in range(len(all_prizes[i])-1):
            if lot == all_prizes[i][j]:
                money1 = money1 + all_prizes[i][-1]
            else:
                money1 = money1 + 0
    money3 = 0
    left = int(lot)-1
    right = int(lot)+1
    if str(left) in all_prizes[5]:
        money3 = money3 + all_prizes[5][-1]
    elif str(right) in all_prizes[5]:
        money3 = money3 + all_prizes[5][-1]
    else:
        money3 = money3 + 0
    money6 = 0
    for i in range(2):
        for j in range(len(all_prizes[i+7])-1):
            if lot[3:] == all_prizes[i+7][j] or lot[4:] == all_prizes[i+7][j]:
                money6 = money6 + all_prizes[i+7][-1]
            else:
                money6 = money6 + 0
    for i in range(len(all_prizes[6])):
        if lot[0:3] == all_prizes[6][i]:
            money6 = money6 + all_prizes[6][-1]
        else:
            money6 = money6 + 0
    summoney = money1 + money3 + money6
    return summoney

6631810921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0NameError("name 'all_prizes' is not defined")
[0, 142, 142]
test_last_digits_check_20.0NameError("name 'all_prizes' is not defined")
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 642, 'const': 850, 'code+const': 1492}
def prize_check (lot,prize):
    sum_prize = 0
    for _ in range(len(prize)-1):
      if prize[_] == lot:
        sum_prize += prize[-1]
    return sum_prize
def big_prizes (lot,prizes):
    sum_big_prizes = 0
    for i in prizes:
      sum_big_prizes += prize_check(lot,i)
    return sum_big_prizes
def next_to_first (lot,prize):
    l = []
    first = int(prize[0])
    left_first,right_first = first-1,first+1
    for i in [left_first,right_first]:
      if i > 999999:
        i = 000000
      elif i < 0:
        i = 999999
      k = str(i)
      if len(k) < 6:
        k = '0'*(6-len(k)) + k
      l.append(k)
    l.append(prize[-1])
    return prize_check(lot,l)
def first_digits_check(lot,prize):
    sum_first = 0
    for _ in range(len(prize)-1):
      if prize[_] == lot[:3]:
        sum_first += prize[-1]
    return sum_first
def last_digits_check(lot,prize):
    sum_last = 0
    if prize == all_prizes[-1]:
      for _ in range(len(prize)-1):
        if prize[_] == lot[4:]:
          sum_last += prize[-1]
    elif prize == all_prizes[-2]:
      for _ in range(len(prize)-1):
        if prize[_] == lot[3:]:
          sum_last += prize[-1]
    return sum_last
def digit_prizes (lot,prizes):
    sum_first = first_digits_check(lot,prizes[0])
    sum_last = last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
    return sum_first + sum_last
def total_prize (lot,all_prizes):
    total = 0
    total += big_prizes(lot,all_prizes[:5])
    total += next_to_first(lot,all_prizes[5])
    total += digit_prizes(lot,all_prizes[6:])
    return total

6632009821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 460, 'const': 548, 'code+const': 1008}
def prize_check (lot,prize):
        m=0
        for e in range(len(prize)-1):
            if lot == prize[e]:
              m+=prize[-1]
        return m
def big_prizes (lot,prizes):
        total = 0
        for e in prizes:
          total+=prize_check(lot,e)
        return total
def next_to_first (lot,prize):
        t = 0
        t+=prize_check(str(int(lot)+1),prize)
        t+=prize_check(str(int(lot)-1),prize)
        return t
def first_digits_check(lot,prize):
        t = 0
        t+=prize_check(lot[0:3],prize)
        return t
def last_digits_check(lot,prize):
        t = 0
        t+=prize_check(lot[-4:-1],prize)
        t+=prize_check(lot[-3:-1],prize)
        return t
def digit_prizes (lot,prizes):
        t = 0
        for e in range(len(prizes)):
          if e ==0:
            t+=first_digits_check(lot,prizes[e])
          else:
           t+=last_digits_check(lot,prizes[e])
        return t
def total_prize (lot,all_prizes):
        t = 0
        t+=big_prizes(lot,all_prizes[0:5])
        t+=next_to_first(lot,all_prizes[5])
        t+=digit_prizes(lot,all_prizes[6:])
        return t

6632034421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 888, 'const': 884, 'code+const': 1772}
def prize_check(lot,prize):
    total = 0
    p = len(prize)
    for i in range(p):
        if lot==prize[i]:
            total += prize[-1]
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes(lot,prizes):
    total=0
    p = len(prizes)
    for i in range(p):
        k = 0
        p = len(prizes[i])
        while k < p:
            if lot==prizes[i][k]:
                total += prizes[i][-1]
            k += 1
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first(lot,prize):
    total=0
    p = len(prize)
    for i in range(p):
        if lot==prize[i]:
            total += prize[-1]
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    total=0
    lot_first_3digits = lot[0:3:1]
    p = len(prize)
    for i in range(p):
        if lot_first_3digits==prize[i]:
            total += prize[-1]
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    total = 0
    p = len(prize)
    lot_last_3digits = lot[4::1]
    lot_last_2digits = lot[5::1]
    for i in range(p):
        if lot_last_3digits==prize[i]:
            total +=prize[-1]
        if lot_last_2digits==prize[i]:
            total += prize[-1]
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes(lot,prizes):
    total = 0
    p = len(prizes)
    lot_first_3digits = lot[0:3:1]
    lot_last_3digits = lot[4::1]
    lot_last_2digits = lot[5::1]
    for i in range(p):
        k = 0
        p = len(prizes[i])
        while k in range(p):
            if lot_first_3digits==prizes[i][k]:
                total +=prizes[i][-1]
            if lot_last_3digits==prizes[i][k]:
                total +=prizes[i][-1]
            if lot_last_2digits==prizes[i][k]:
                total += prizes[i][-1]
            k += 1
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize(lot,all_prizes):
    total = 0
    ap = len(all_prizes)
    for i in range(ap):
        k = 0
        ap = len(all_prizes[i])
        while k < ap:
            if lot==all_prizes[i][k]:
                total += all_prizes[i][-1]
            if lot[0:3:1]==all_prizes[i][k]:
                total+=all_prizes[i][-1]
            if lot[4::1]==all_prizes[i][k]:
                total+=all_prizes[i][-1]
            if lot[5::1]==all_prizes[i][k]:
                total += all_prizes[i][-1]
            k += 1
    return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6632174621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0, 0987]
test_next_to_first_20.0
[0, 987, 0987, 0, 0987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 456, 'const': 700, 'code+const': 1156}
def prize_check(lot, prize):
    total = 0
    for i in range(len(prize) - 1):
      if lot == prize[i]:
          total += int(prize[-1])
    return total
def big_prizes(lot, prizes):
    total = 0
    for i in range(5):
        total += prize_check(lot, prizes[i])
    return total
def next_to_first(lot, prizes):
    total = prize_check(lot, prizes)
    return total
def first_digits_check(lot, prizes):
    total = prize_check(lot[:3], prizes)
    return total
def last_digits_check(lot, prizes):
    total = prize_check(lot[4:6], prizes)
    return total
def digit_prizes(lot, prizes):
    check_first_digit = prize_check(lot[:3], prizes[0])
    check_set2_first_digit = prize_check(lot[:3], prizes[1])
    check_last_digit = prize_check(lot[4:7], prizes[2])
    return check_first_digit + check_set2_first_digit + check_last_digit
def total_prize(lot, all_prizes):
    prize1_check = prize_check(lot,all_prizes[0])
    prize2_check = prize_check(lot,all_prizes[1])
    prize3_check = prize_check(lot,all_prizes[2])
    prize4_check = prize_check(lot,all_prizes[3])
    prize5_check = prize_check(lot,all_prizes[4])
    next_to_first_prize_check = next_to_first(lot,all_prizes[5])
    digit_prize_check = digit_prizes(lot,all_prizes[6:])
    total_prize = prize1_check + prize2_check + prize3_check + prize4_check + prize5_check + next_to_first_prize_check + digit_prize_check
    return total_prize

6632189021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 728, 'const': 876, 'code+const': 1604}
def prize_check (lot,prize):
    lp = prize
    m = 0
    for i in range (0, len(lp)):
        if lp[i] == lot:
            m += lp[len(lp) - 1]
    return m
def big_prizes (lot,prizes):
    lp = prizes
    m = 0
    for i in range (0, len(lp)):
        lpc = lp[i]
        for j in range (0, len(lpc)):
            if lpc[j] == lot:
                m += lpc[len(lpc) - 1]
    return m
def next_to_first (lot,prize):
    lp = prize
    m = 0
    lon = len(lp[0])
    lp1 = int(lp[0]) - 1
    lp2 = int(lp[0]) + 1
    if lp1 == -1:
        lp1 = 999999
    if lp2 == 1000000:
        lp2 = 0
    lpn = str(lp1)
    lpx = str(lp2)
    if len(lpn) != lon:
        lpn = '0' * (lon - len(lpn)) + lpn
    if lon != lpx:
        lpx = '0' * (lon - len(lpx)) + lpx
    if lot == lpn or lot == lpx:
        m += lp[1]
    return m
def first_digits_check(lot,prize):
    lp = prize
    m = 0
    fd = []
    for x in lot:
        if len(fd) <= 2:
            fd.append(str(x))
    f = ''.join(fd)
    if f in lp:
        m += lp[len(lp) - 1]
    return m
def last_digits_check(lot,prizes):
    lp = prizes
    m = 0
    ld = []
    for x in lot:
        ld.append(str(x))
    l3 = ''.join(ld[3:6])
    l2 = ''.join(ld[4:6])
    if l2 in lp:
        m += lp[len(lp) - 1]
    if l3 in lp:
        m += lp[len(lp) - 1]
    return m
def digit_prizes (lot,prizes):
    return first_digits_check(lot,all_prizes[6]) + last_digits_check(lot,all_prizes[7])  + last_digits_check(lot,all_prizes[8])
def total_prize (lot,all_prizes):
    return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6632237521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[710, 0142, 0142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 58111]
test_total_prize1.0
[186005]
bytecount: {'code': 718, 'const': 718, 'code+const': 1436}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in range(len(prize)-1):
          if lot == prize[i]:
            money += prize[len(prize)-1]
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        n = len(prizes)
        for i in range(n):
          for j in range(len(prizes[i])-1):
            if lot == prizes[i][j]:
              money += prizes[i][len(prizes[i])-1]
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        nearest_left = 0
        nearest_right = 0
        money = 0
        curr = prize[0]
        if curr=="999999":
          nearest_right = "000000"
        else:
          nearest_right = str(int(curr)+1)
        if curr=="000000":
          nearest_left = "999999"
        else:
          nearest_left = str(int(curr)-1)
        #print("two below is nearest")
        #print(nearest_left)
        #print(nearest_right)
        if lot == nearest_left or lot == nearest_right:
          money += prize[1]
        return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        sublot = lot[0:3]
        money = 0
        for i in range(len(prize)-1):
          if sublot == prize[i]:
            money+=prize[len(prize)-1]
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # digit check
        money = 0
        digit = len(prize[0])
        if digit==3:
          sublot = lot[len(prize)-3:len(prize)]
          for i in range(len(prize)-1):
            if sublot == prize[i]:
              money+=prize[len(prize)-1]
        elif digit==2:
          sublot = lot[len(prize)-2:len(prize)]
          for i in range(len(prize)-1):
            if sublot == prize[i]:
              money+=prize[len(prize)-1]
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        money = first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
        return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        money = digit_prizes(lot,all_prizes[6:])+big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])
        return money

6531006621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 474, 'const': 688, 'code+const': 1162}
def prize_check(lot, prize):
    total = 0
    for p in prize:
        if lot == p:
            total += prize[-1]
    return total
def big_prizes(lot, prizes):
    total = 0
    for prize in prizes:
        total += prize_check(lot, prize)
    return total
def next_to_first(lot, prize):
    total = 0
    for p in prize:
        if abs(int(lot) - int(p)) == 1:
            total += prize[-1]
    return total
def first_digits_check(lot, prize):
    total = 0
    for p in prize:
        if lot[:3] == p:
            total += prize[-1]
    return total
def last_digits_check(lot, prize):
    total = 0
    for p in prize:
        if lot[-3:] == p:
            total += prize[-1]
        if lot[-2:] == p:
            total += prize[-1]
    return total
def digit_prizes(lot, prizes):
    total = 0
    total += first_digits_check(lot,all_prizes[-3])
    total += first_digits_check(lot,all_prizes[-2])
    total += last_digits_check(lot,all_prizes[-1])
    return total
def total_prize(lot, all_prizes):
    total = 0
    total += prize_check(lot, all_prizes[0])   # รางวัลที่ 1
    total += big_prizes(lot, all_prizes[1:5])  # รางวัลใหญ่รวม
    total += next_to_first(lot, all_prizes[5]) # รางวัลข้างเคียงรางวัลที่ 1
    total += digit_prizes(lot, all_prizes[6:]) # เลขหน้าและเลขท้ายรวม
    return total

6531502521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_10.0
[None0, 71, 71]
test_first_digits_check_20.0
[None0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 964, 'const': 1290, 'code+const': 2254}
def prize_check (lot,prize):
    s = prize[:-1]
    total = 0
    for i in range(int(len(s))):
        if lot == s[i-1]:
            total += prize[-1]
    else:
        total += 0
    return total
def big_prizes (lot,prizes):
    total = 0
    for j in range(int(len(prizes))):
        h = prizes[j-1]
        y = h[:-1]
        for k in range(len(y)):
            if lot == y[k-1]:
                total += h[-1]
        else:
            total +=  0
    return total
def next_to_first (lot,prize):
    f = prize
    first = f[0]
    first_up = str(int(first)+1)
    first_down = str(int(first)-1)
    if first_down=='-1':
        first_down = '999999'
    if first_up=='999999+1':
        first_up = '000000'
    if lot == first_down or lot == first_up:
        return f[-1]
    else:
        return 0
def first_digits_check(lot,prize):
    c = prize[:-1]
    for t in range(len(c)):
        if lot[:3] == c[t-1]:
            return prize[-1]
def last_digits_check(lot,prize):
    ldc = prize[:-1]
    if str(len(ldc[0])) == '3':
        for e in range(len(ldc)):
            if lot[-3:] == ldc[e-1]:
                return prize[-1]
            else:
                return 0
    elif str(len(ldc[0])) == '2':
        for o in range(len(ldc)):
            if lot[-2:] == ldc[o-1]:
                return prize[-1]
            else:
                return 0
def digit_prizes (lot,prizes):
    f3 = prizes[0]
    l3 = prizes[1]
    l2 = prizes[2]
    ff3 = f3[:-1]
    ll3 = l3[:-1]
    ll2 = l2[:-1]
    total = 0
    for r in range(len(ff3)):
        if lot[:3] == ff3[r-1]:
            total += f3[-1]
    for d in range(len(ll3)):
        if lot[-3:] == ll3[d-1]:
            total += l3[-1]
    for s in range(len(ll2)):
        if lot[-2:] == ll2[s-1]:
            total += l2[-1]
    return total
def total_prize (lot,all_prizes):
    lot1 = prize_check(lot,all_prizes[0])
    lot2 = prize_check(lot,all_prizes[1])
    lot3 = prize_check(lot,all_prizes[2])
    lot4 = prize_check(lot,all_prizes[3])
    lot5 = prize_check(lot,all_prizes[4])
    lotn1 = next_to_first(lot,all_prizes[5])
    lot332 = digit_prizes (lot,all_prizes[6:])
    total = lot1+lot2+lot3+lot4+lot5+lotn1+lot332
    return total

6630022521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 576, 'const': 880, 'code+const': 1456}
def prize_check (lot,prize):
  prize1 =prize[:len(prize)-1]
  rew  = prize[-1]
  total = 0
  for i in prize1:
    if i == lot:
      total += rew
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
   total = 0
   for i in prizes:
    total += prize_check(lot,i)
   return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  total = 0
  prize5 = int(prize[0])
  if lot =="999999":
     if prize[0]=="999998" or prize[0] =="000000":
      total = prize[-1]
  elif lot =="000000":
     if prize[0]=="000001" or prize[0]=="999999":
      total = prize[-1]
  elif lot == str(prize5-1) or lot == str(prize5+1):
      total = prize[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  total = 0
  prize6 = prize[:-1]
  for i in prize6:
    if i == lot[:3]:
      total = prize[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  total = 0
  prize7 = prize[:-1]
  for i in prize7 :
    if i == lot[-3:] or i == lot[-2:]:
      total = prize[-1]
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  total = 0
  p1 = first_digits_check(lot,prizes[0])
  p2 = last_digits_check(lot,prizes[1])
  p3 = last_digits_check(lot,prizes[2])
  total = p1 + p2 + p3
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  total = 0
  p1 = big_prizes(lot,all_prizes[0:5])
  p2 = next_to_first(lot,all_prizes[5])
  p3  = digit_prizes(lot,all_prizes[6:])
  total = p1+p2+p3
  return total
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630027721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[None0, 987, 987]
test_next_to_first_20.0
[None0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 614, 'const': 936, 'code+const': 1550}
def prize_check (lot,prize):
    total = 0
    for e in prize:
        if e == lot:
            total += prize[-1]
    return total
def big_prizes (lot,prizes):
    total = 0
    for e in prizes:
            for i in e:
                if i == lot:
                    total += e[-1]
    return total
def next_to_first (lot,prize):
    total = 0
    if prize[0] == "000000":
        if lot == "999999" or lot == "000001":
            total += prize[-1]
            return total
    if prize[0] == "999999":
        if lot == "000000" or lot == "999998":
            total += prize[-1]
            return total
    if int(lot) == (int(prize[0])+1) or int(lot) == (int(prize[0])-1):
        total += prize[-1]
        return total
def first_digits_check(lot,prize):
    total = 0
    for e in prize[0:2]:
        if int(e) == int(lot[0:3]):
            total += prize[-1]
    return total
def last_digits_check(lot,prize):
    total = 0
    if len(prize) == 3:
        for e in prize[0:2]:
            if int(e) == int(lot[3:]):
                total += prize[-1]
    if len(prize) == 2:
        for e in prize[0:2]:
            if int(e) == int(lot[4:]):
                total += prize[-1]
    return total
def digit_prizes (lot,prizes):
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
    return  big_prizes (lot,all_prizes[0:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6630047221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_10.0
[0, 0987, 0987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 720, 'const': 941, 'code+const': 1661}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    sum_prize = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            sum_prize += prize[-1]
    return sum_prize
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    sum_prizes = 0
    for i in range(len(prizes)-1):
        sum_prizes += prize_check(lot,all_prizes[i])
    return sum_prizes
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    sum_prize = 0
    if lot[:-1] == prize[0][:-1]:
        if int(lot[-1]) == int(prize[0][-1]) -1 or int(lot[-1]) == int(prize[0][-1]) +1:
            sum_prize = prize[-1]
    elif prize[0] == '000000':
        if lot == '000001' or lot == '999999':
            sum_prize = prize[-1]
    elif prize[0] == '999999':
        if lot == '000001' or lot == '000000':
            sum_prize = prize[-1]
    return sum_prize
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    sum_prize = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
           sum_prize += prize[-1]
    return sum_prize
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    sum_prize = 0
    for i in range(len(prize)-1):
        if len(prize[i]) == 2:
            if lot[-2:] == prize[i]:
                sum_prize += prize[-1]
        elif len(prize[i]) == 3:
            if lot[-3:] == prize[i]:
                sum_prize += prize[-1]
    return sum_prize
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    sum_prizes = 0
    for i in range(len(prizes)):
        if i == 0:
            sum_prizes += first_digits_check(lot,prizes[i])
        elif i == 1:
            sum_prizes += last_digits_check(lot,prizes[i])
        elif i == 2:
            sum_prizes += last_digits_check(lot,prizes[i])
    return sum_prizes
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    sum_prizes = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
    return sum_prizes

6630096021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[9870, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 450, 'const': 548, 'code+const': 998}
def prize_check (lot,prize):
    s=0
    for i in range(len(prize)):
        if prize[i]==lot:
            s=s+prize[-1]
    return s
def big_prizes (lot,prizes):
    s=0
    for i in prizes:
        s+=prize_check(lot,i)
    return s
def next_to_first (lot,prize):
    s=0
    for i in prize:
        s=prize[-1]
    return s
def first_digits_check(lot,prize):
    s=0
    a=lot[:3]
    for i in range(len(prize)):
        if a==prize[i]:
            s+=prize[-1]
    return s
def last_digits_check(lot,prize):
    s=0
    for i in range(len(prize)):
        if lot[4:]==prize[i] :
            s+=prize[-1]
        elif lot[5:]==prize[i]:
            s+=prize[-1]
    return s
def digit_prizes (lot,prizes):
    s=0
    for i in prizes:
        s+=first_digits_check(lot,i)
    for i in prizes:
        s+=last_digits_check(lot,i)
    return s
def total_prize (lot,all_prizes):
    s=big_prizes(lot,all_prizes[0:5])+next_to_first(lot,all_prizes[5])+digit_prizes(lot,all_prizes[6:])
    return s

6631012421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[222222111111, 913456789, 12346905, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[102483]
test_big_prizes_20.0
[102483]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 2554, 'const': 1136, 'code+const': 3690}
def prize_check (lot,prize):
  i = 0
  reward = 0
  while i <= len(prize[:-1]):
       if int(lot) == int(prize[i]) :
          reward += prize[-1]
          i +=1
       else :
          reward += 0
          i +=1
  return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    reward = 0
    i = 0
    if int(lot) == int(prizes[0][0]):
       reward += prizes[0][-1]
    else:
       reward += 0
    i = 0
    while i <= len(prizes[1][:-1]):
          if int(lot) == int(prizes[1][i]):
             reward += prizes[1][-1]
             i +=1
          else:
             reward += 0
             i +=1
    i = 0
    while i <= len(prizes[2][:-1]):
          if int(lot) == int(prizes[2][i]):
             reward += prizes[2][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(prizes[3][:-1]):
          if int(lot) == int(prizes[3][i]):
             reward += prizes[3][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(prizes[2][:-1]):
          if int(lot) == int(prizes[4][i]):
             reward += prizes[4][-1]
             i +=1
          else:
              reward += 0
              i +=1
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    reward = 0
    if int(lot) == (int(prize[0])- 1) or int(lot) == (int(prize[0])+ 1):
      reward += prize[1]
    else :
      reward += 0
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    reward = 0
    i = 0
    while i <= len(prize[:-1]):
      if int(lot[:3]) == int(prize[i]):
              reward += prize[-1]
              i +=1
      else:
              reward += 0
              i +=1
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    i = 0
    reward = 0
    if   len(prize[0]) == 2:
         while i <= len(prize[:-1]):
               if int(lot[4:]) == int(prize[i]):
                  reward += prize[-1]
                  i +=1
               else:
                   reward += 0
                   i +=1
    elif len(prize[0]) == 3:
         while i <= len(prize[:-1]):
               if int(lot[3:]) == int(prize[i]):
                  reward += prize[-1]
                  i +=1
               else:
                   reward += 0
                   i +=1
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    i = 0
    reward = 0
    while i <= len(prizes[0][:-1]):
          if int(lot[:3]) == int(prizes[0][i]):
             reward += prizes[0][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(prizes[1][:-1]):
          if int(lot[3:]) == int(prizes[1][i]):
             reward += prizes[1][-1]
             i +=1
          else:
             reward += 0
             i +=1
    i = 0
    while i <= len(prizes[2][:-1]):
          if int(lot[4:]) == int(prizes[2][i]):
             reward += prizes[2][-1]
             i +=1
          else:
              reward += 0
              i +=1
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    reward = 0
    if int(lot)== int(all_prizes[0][0]):
       reward += all_prizes[0][-1]
    else:
        reward += 0
    i = 0
    while i <= len(all_prizes[1][:-1]):
          if int(lot) == int(all_prizes[1][i]):
             reward += all_prizes[1][-1]
             i +=1
          else:
             reward += 0
             i +=1
    i = 0
    while i <= len(all_prizes[2][:-1]):
          if int(lot) == int(all_prizes[2][i]):
             reward += all_prizes[2][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(all_prizes[3][:-1]):
          if int(lot) == int(all_prizes[3][i]):
             reward += all_prizes[3][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(all_prizes[2][:-1]):
          if int(lot) == int(all_prizes[4][i]):
             reward += all_prizes[4][-1]
             i +=1
          else:
              reward += 0
              i +=1
    if int(lot) == (int(all_prizes[5][0])- 1) or int(lot) == (int(all_prizes[5][0])+ 1):
       reward += all_prizes[5][-1]
    i = 0
    while i <= len(all_prizes[6][:-1]):
          if int(lot[:3]) == int(all_prizes[6][i]):
             reward += all_prizes[6][-1]
             i +=1
          else:
              reward += 0
              i +=1
    i = 0
    while i <= len(all_prizes[7][:-1]):
          if int(lot[3:]) == int(all_prizes[7][i]):
             reward += all_prizes[7][-1]
             i +=1
          else:
             reward += 0
             i +=1
    i = 0
    while i <= len(all_prizes[8][:-1]):
          if int(lot[4:]) == int(all_prizes[8][i]):
             reward += all_prizes[8][-1]
             i +=1
          else:
              reward += 0
              i +=1
    return(reward)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631013021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 482, 'const': 608, 'code+const': 1090}
def prize_check(lot, prize):
    m = 0
    for a in prize[:-1]:
        if lot == a:
            m += prize[-1]
    return m
def big_prizes(lot, prizes):
    m = 0
    for prize in prizes:
        m += prize_check(lot, prize)
    return m
def next_to_first(lot, prize):
    m = 0
    if int(lot) == int(prize[0]) + 1 or int(lot) == int(prize[0]) - 1:
        m += prize[-1]
    return m
def first_digits_check(lot, prize):
    m = 0
    for a in prize[:-1]:
        if lot[:3] == a:
            m += prize[-1]
    return m
def last_digits_check(lot, prize):
    m = 0
    if len(lot) == 3:
        if lot[-3:] in prize[:-1]:
            m += prize[-1]
    else:
        if lot[-2:] in prize[:-1]:
            m += prize[-1]
    return m
def digit_prizes(lot, prizes):
    m = 0
    m += first_digits_check(lot, prizes[0])
    for prize in prizes[1:]:
        m += last_digits_check(lot, prize)
    return m
def total_prize(lot, all_prizes):
    return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6631125721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 29, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 824, 'code+const': 1418}
def prize_check (lot,prize):
  x = 0
  for i in prize[:-1]:
    if lot == i:
     x += int(prize[-1])
  return x
def big_prizes (lot,prizes):
  x = 0
  for prize in prizes:
    x += prize_check (lot,prize)
  return x
def next_to_first (lot,prize):
  x = 0
  next = []
  first,p = prize
  if first == '000000':
    next += ['999999','000001']
  elif first == '999999':
    next += ['999998','000000']
  else:
    next += [str(int(first)-1),str(int(first)+1)]
  for i in next:
    if lot == i:
      x += p
  return x
def first_digits_check(lot,prize):
  x = 0
  for i in prize[:-1]:
    if lot[:3] == i:
      x += prize[-1]
  return x
def last_digits_check(lot,prize):
  x =0
  for i in prize[:1]:
    if len(i) == 3:
      if lot[3:] == i:
        x += prize[-1]
    elif len(i) == 2:
      if lot[-2:] == i:
        x += prize[-1]
    else:
      pass
  return x
def digit_prizes (lot,prizes):
  x = 0
  for i in range(len(prizes)):
    if i == 0:
      x += first_digits_check(lot,prizes[i])
    else:
      x += last_digits_check(lot,prizes[i])
  return x
def total_prize (lot,all_prizes):
  x = 0
  x += big_prizes (lot,all_prizes[:5])
  x += next_to_first (lot,all_prizes[5])
  x += digit_prizes (lot,all_prizes[6:])
  return x

6631212621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 29, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 612, 'const': 824, 'code+const': 1436}
def prize_check (lot,prize):
    n = 0
    for number in prize[:-1]:
        if lot == number:
            n += int(prize[-1])
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    n = 0
    for prize_n in prizes:
        n += prize_check(lot,prize_n)
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    next = []
    first,pz = prize
    n = 0
    if first == '000000':
        next += ['999999','000001']
    elif first == '999999':
        next += ['999998','000000']
    else:
        next += [str(int(first)-1),str(int(first)+1)]
    for number in next:
        if lot == number:
            n += pz
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    n = 0
    for first_digits_number in prize[:-1] :
        if lot[:3] == first_digits_number:
            n += prize[-1]
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    n = 0
    for last_digits_number in prize[:-1]:
        if len(last_digits_number) == 3:
            if lot[-3:] == last_digits_number:
                n += prize[-1]
        elif len(last_digits_number) == 2:
            if lot[-2:] == last_digits_number:
                n += prize[-1]
            else:
                pass
        return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    n = 0 
    for digit_prizes_number in range(len(prizes)):
        if digit_prizes_number == 0:
            n += first_digits_check(lot,prizes[digit_prizes_number])
        else:
            n += last_digits_check(lot,prizes[digit_prizes_number])
    return n   
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    n = 0
    n += big_prizes(lot,all_prizes[:5])
    n += next_to_first(lot,all_prizes[5])
    n += digit_prizes(lot,all_prizes[6:])
    return n 
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631219021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 464, 'const': 528, 'code+const': 992}
def prize_check(lot, prize):
    count = prize[:-1].count(lot)
    prize_money = prize[-1] * count
    return prize_money
def big_prizes(lot, prizes):
    total_prize = 0
    for prize in prizes:
        prize_money = prize_check(lot, prize)
        total_prize = total_prize + prize_money
    return total_prize
def next_to_first(lot, prize):
    number_1 = int(prize[0])
    adjacent_num1 = (number_1 - 1) % 1000000
    adjacent_num2 = (number_1 + 1) % 1000000
    adjacent_num1_str = str(adjacent_num1).zfill(6)
    adjacent_num2_str = str(adjacent_num2).zfill(6)
    if lot == adjacent_num1_str or lot == adjacent_num2_str:
        return prize[1]
    else:
        return 0
def first_digits_check(lot, prize):
    first_three_digits_lot = lot[:3]
    if first_three_digits_lot in prize[:-1]:
        return prize[-1]
    else:
        return 0
def last_digits_check(lot, prize):
    length_of_prize_num = len(prize[0])
    last_digits_lot = lot[-length_of_prize_num:]
    if last_digits_lot in prize[:-1]:
        return prize[-1]
    else:
        return 0
def digit_prizes(lot, prizes):
    total_prize = 0
    for prize in prizes:
        if len(prize[0]) == 3:
            prize_money = first_digits_check(lot, prize)
        else:
            prize_money = last_digits_check(lot, prize)
        total_prize = total_prize + prize_money
    return total_prize
def total_prize(lot, all_prizes):
    big_prize_money = big_prizes(lot, all_prizes[:5])
    next_to_first_prize_money = next_to_first(lot, all_prizes[5])
    digit_prizes_money = digit_prizes(lot, all_prizes[6:])
    total_prize_money = big_prize_money + next_to_first_prize_money + digit_prizes_money
    return total_prize_money

6631228721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'b' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'b' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 1676, 'const': 1464, 'code+const': 3140}
def prize_check (lot,prize):
  p = 0
  if lot in prize[:-1]:
    for x in range(len(prize)-1):
      if lot == prize[x]:
        p += prize[-1]
  return p
def big_prizes (lot,prizes):
  p = 0
  for x in range(5):
    if lot in prizes[x][:-1]:
      for y in range(len(prizes[x])-1):
        if lot == prizes[x][y]:
          p += prizes[x][-1]
  return p
def next_to_first (lot,prize):
  p = 0
  q = [0,0]
  if prize[0] == '999999':
    q[0] = '999998'
    q[1] = '000000'
  elif prize[0] == '000000':
      q[0] = '999999'
      q[1] = '000001'
  else:
        q[0] = int(prize[0])-1
        q[1] = int(prize[0])+1
  if int(lot) == int(q[0]) or int(lot) == int(b[1]):
          p += prize[-1]
  return p
def first_digits_check(lot,prize):
  p = 0
  if lot[0:3] in prize[:-1][0:3]:
    for x in range(len(prize)-1):
      if lot[0:3] == prize[x][0:3]:
        p += prize[-1]
  return p
def last_digits_check(lot,prize):
  p = 0
  if len(prize[0]) == 3:
    if lot[3:] in prize[:-1]:
      for x in range(len(prize)-1):
        if lot [3:] == prize[x]:
          p += prize[-1]
  elif len(prize[0]) == 2:
    if lot[4:] in prize[:-1]:
      for x in range(len(prize)):
        if lot[4:] == prize[x]:
          p += prize[-1]
  return p
def digit_prizes (lot,prizes):
  p = 0
  for x in range(3):
    if len(prizes[x][0]) == 3:
      if lot[3:] in prizes[x][:-1]:
        for y in range(len(prizes[x])-1):
          if lot[3:] == prizes[x][y]:
            p += prizes[x][-1]
      elif lot[0:3] == prizes[x][:-1]:
        for y in range(len(prizes)-1):
          if lot[0:3] == prizes[x][y]:
            p += prizes[x][-1]
    elif len(prizes[x][0]) == 2:
      if lot[4:] in prizes[x][:-1]:
        for y in range(len(prizes[x])-1):
          if lot[4:] == prizes[x][y]:
            p += prizes[x][-1]
  return p
def total_prize (lot,all_prizes):
  p = 0
  for x in range(len(all_prizes)):
    if lot in all_prizes[x][:-1]:
      for y in range(len(all_prizes[x])-1):
        if lot == all_prizes[x][y]:
          p += all_prizes[x][-1]
    elif all_prizes[x][-1] == 100000:
      q = [0,0]
      if all_prizes[x][0] == '999999':
        q[0] = '999998'
        q[1] = '000000'
      elif  all_prizes[x][0] == '000000':
        q[0] = '999999'
        q[1] = '000001'
      else:
        q[0] = int(all_prizes[x][0])-1
        q[1] = int(all_prizes[x][0])+1
      if int(lot) == int(q[0]) or int(lot) == int(b[1]):
        p += all_prizes[x][-1]
    elif len(all_prizes[x][0]) == 3:
      if lot[3:] in all_prizes[x][:-1]:
        for y in range(len(all_prizes[x])-1):
          if lot [3:] == all_prizes[x][y]:
            p += all_prizes[x][-1]
      elif lot[0:3] in all_prizes[x][:-1]:
        for y in range(len(prize)-1):
          if lot[0:3] == all_prizes[x][y]:
            p += all_prizes[x][-1]
    elif len(all_prizes[x][0]) == 2:
      if lot[4:] in all_prizes[x][:-1]:
        for y in range(len(all_prizes[x])-1):
          if lot[4:] == all_prizes[x][y]:
            p += all_prizes[x][-1]
  return p

6631513521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 858, 'const': 969, 'code+const': 1827}
def prize_check (lot,prize):
    get=0
    for i in range (len(prize)-1):
        if lot==prize[i]:
            get+=prize[len(prize)-1]
        else:
            continue
    return get
def big_prizes (lot,prizes):
    get=0
    for i in range(5):
        x=prizes[i]
        for j in range (len(x)-1):
            if lot==x[j]:
                get+=x[len(x)-1]
            else:
                continue
    return get
def next_to_first (lot,prize):
    get=0
    for i in range (len(prize)-1):
        if prize[0]=='999999':
            if lot=='000000'or lot=='999998':
                get+=prize[len(prize)-1]
        elif lot==(str(int(prize[i])-1)) or lot==(str(int(prize[i])-1)) :
            get+=prize[len(prize)-1]
        else:
            continue
    return get
def first_digits_check(lot,prize):
    get=0
    for i in range (len(prize)-1):
        if lot[:3]==prize[i]:
            get+=prize[len(prize)-1]
        else:
            continue
    return get
def last_digits_check(lot,prize):
    get1=0
    get2=0
    for i in range (len(prize)-1):
        if lot[3:]==prize[i]:
            get1+=prize[len(prize)-1]
        else:
            continue
    for i in range (len(prize)-1):
        if lot[4:]==prize[i]:
            get2+=prize[len(prize)-1]
        else:
            continue
    return get1+get2
def digit_prizes (lot,prizes):
    get1=first_digits_check(lot,all_prizes[6])
    get2=0
    get3=0
    for i in range(1,3):
      if prizes[i]==all_prizes[7]:
        for i in range (len(prizes[i])-1):
          if lot[3:]==prizes[i]:
            get2+=prize[len(prizes[i])-1]
          else:
            continue
      elif prizes[i]==all_prizes[8]:
        x=prizes[i]
        if lot[4:]==x[0]:
            get3=2000
        else:
            continue
    return get1+get2+get3
def total_prize (lot,all_prizes):
    get1=big_prizes(lot,all_prizes[:5])
    get2=next_to_first(lot,all_prizes[5])
    get3=first_digits_check(lot,all_prizes[6])
    get4=last_digits_check(lot,all_prizes[8])
    return get1+get2+get3+get4

6631516421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_10.0
[111111, 0456789, 012345, 0]
test_prize_check_20.0
[123468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 524, 'const': 688, 'code+const': 1212}
def prize_check(lot, prize):
    total_money = 0
    if lot == prize[0]:
        total_money += prize[-1]
    return total_money
def big_prizes(lot, prizes):
    total_money = 0
    for j in prizes:
        for i in j[:-1]:
            if lot == i:
                total_money += j[-1]
    return total_money
def next_to_first(lot, prize):
    total_money = 0
    near_prize = [str(int(prize[0])-1), str(int(prize[0])+1)]
    for i in near_prize:
        if lot == i:
            total_money += prize[-1]
    return total_money
def first_digits_check(lot, prize):
    total_money = 0
    for i in prize[:-1]:
        if lot[:3] == i:
            total_money += prize[-1]
    return total_money
def last_digits_check(lot, prize):
    total_money = 0
    for i in prize[:-1]:
        if lot[3:] == i:
            total_money += prize[-1]
    return total_money
def digit_prizes(lot, prizes):
    total_money = 0
    front_3 = prizes[0]
    last_3 = prizes[1]
    last_2 = prizes[2]
    total_money += first_digits_check(lot, front_3)
    total_money += last_digits_check(lot, last_3)
    for i in last_2[:-1]:
        if lot[4:] == i:
            total_money += last_2[-1]
    return total_money
def total_prize(lot, prizes):
    total_money = 0
    total_money += big_prizes(lot, prizes[:5]) # get 5 prizes
    total_money += next_to_first(lot, prizes[5]) # get near big prize
    total_money += digit_prizes(lot, prizes[6:]) # get others
    return total_money

6631548521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 420, 'const': 612, 'code+const': 1032}
def prize_check(lot, prize):
    return prize[:-1].count(lot) * prize[-1]
def big_prizes(lot, prizes):
    total = 0
    for prize in prizes:
        total += prize_check(lot, prize)
    return total
def next_to_first(lot, prize):
    first_prize_num = int(prize[0])
    if int(lot) == first_prize_num + 1 or int(lot) == first_prize_num - 1:
        return prize[1]
    return 0
def first_digits_check(lot, prize):
    if lot[:3] in prize[:-1]:
        return prize[-1]
    return 0
def last_digits_check(lot, prize):
    # Checking for 2 digits
    if len(prize[0]) == 2 and lot[-2:] in prize[:-1]:
        return prize[-1]
    # Checking for 3 digits
    elif len(prize[0]) == 3 and lot[-3:] in prize[:-1]:
        return prize[-1]
    return 0
def digit_prizes(lot, prizes):
    return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize(lot, all_prizes):
    return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6631550721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 71, 071]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 586, 'const': 797, 'code+const': 1383}
def prize_check (lot,prize):
    x = 0
    for num in prize[:-1]:
        if lot == num:
            x += int(prize[-1])
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    x = 0
    for prize in prizes:
        x += prize_check(lot, prize)
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    x = 0
    next_to = []
    first, p = prize
    if first == '000000':
        next_to += ['999999', '000001']
    elif first == '999999':
        next_to += ['999999', '000000']
    else:
        next_to = [str(int(first) - 1), str(int(first) + 1)]
    for num in next_to:
        if lot == num:
            x += p
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    x = 0
    for num in prize[:1]:
        if lot[:3] == num:
            x += prize[-1]
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    x = 0
    for num in prize[:-1]:
        if len(num) == 3:
            if lot[-3:] == num:
                x += prize[-1]
        elif len(num) == 2:
            if lot[-2:] == num:
                x += prize[-1]
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    x = 0
    for i in range(len(prizes)):
        if i == 0:
            x += first_digits_check(lot, prizes[i])
        else:
            x += last_digits_check(lot, prizes[i])
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    x = 0
    x += big_prizes(lot, all_prizes[:5])
    x += next_to_first(lot, all_prizes[5])
    x += digit_prizes(lot, all_prizes[6:])
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631551321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 142]
test_last_digits_check_20.0
[0, 0, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 564, 'const': 717, 'code+const': 1281}
def prize_check (lot,prize):
  x = 0
  for i in prize :
    if lot == i :
      x += int(prize[-1])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  x = 0
  for i in prizes :
    x += prize_check(lot,i)
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  x = 0
  for i in prize[0:-1] :
    if int(lot)+1 == int(i) or int(lot)-1 == int(i):
      x += int(prize[-1])
  if prize[0] == '000000':
    x = 0
    if lot == "000001" or "999999":
      x += int(prize[-1])
    else:
      x = 0
  if prize[0] == '999999':
    x = 0
    if lot == "000000" or "999998":
      x += int(prize[-1])
    else:
      x = 0
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  x = 0
  for i in prize :
    if lot[:3] == i:
      x += int(prize[-1])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  x = 0
  for i in prize :
    if lot[-1:-4:-1] == i or lot[-1:-3:-1] == i:
      x += int(prize[-1])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  x = 0
  for i in range(len(prizes)) :
    if i == 0 :
      x += first_digits_check(lot,prizes[i])
    else :
      x += last_digits_check(lot,prizes[i])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  sum = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631553621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 71, 071]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 586, 'const': 797, 'code+const': 1383}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for num in prize[:-1]:
        if lot == num:
            x += int(prize[-1])
    return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for prize in prizes:
        x += prize_check(lot, prize)
    return x
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    x = 0
    next_to = []
    first, p = prize
    if first == '000000':
        next_to += ['999999', '000001']
    elif first == '999999':
        next_to += ['999999', '000000']
    else:
        next_to = [str(int(first) - 1), str(int(first) + 1)]
    for num in next_to:
        if lot == num:
            x += p
    return x
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for num in prize[:1]:
        if lot[:3] == num:
            x += prize[-1]
    return x
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    x = 0
    for num in prize[:-1]:
        if len(num) == 3:
            if lot[-3:] == num:
                x += prize[-1]
        elif len(num) == 2:
            if lot[-2:] == num:
                x += prize[-1]
    return x
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    x = 0
    for i in range(len(prizes)):
        if i == 0:
            x += first_digits_check(lot, prizes[i])
        else:
            x += last_digits_check(lot, prizes[i])
    return x
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    x = 0
    x += big_prizes(lot, all_prizes[:5])
    x += next_to_first(lot, all_prizes[5])
    x += digit_prizes(lot, all_prizes[6:])
    return x

6631804121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 572, 'const': 795, 'code+const': 1367}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    summ = 0
    for i in prize[:-1]:
        if lot == i:
            summ += prize[-1]
    return summ
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    summ = 0
    prizess = 0
    for prize in prizes :
        prizess=prize_check (lot,prize)
        summ+=prizess
    return summ
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    summ  = 0
    nextt = []
    first,prizess  = prize
    if first == "000000":
        change1 = ["999999","000001"]
        nextt+=change1
    elif first == "999999":
        change2 = ["100000","999998"]
        nextt +=change2
    else:
        ch1 = int(first)-1
        ch2 = int(first)+1
        nextt+=[str(ch1),str(ch2)]
    for i in nextt:
        if lot == i :
            summ+=prizess
    return summ
def first_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    summ = 0
    for i in prize[:-1]:
        lot1 = lot[:3]
        if lot1 == i:
            summ+=prize[-1]
    return summ
def last_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    summ = 0
    for i in prize[:-1] :
        lot1 = lot[-2:]
        if lot1 == i:
            summ+=prize[-1]
    return summ
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    summ = 0
    for i in range(len(prizes)) :
        if i ==  0:
            prizess = first_digits_check (lot,prizes[i])
            summ+=prizess
        else:
            prizess = last_digits_check (lot,prizes[i])
            summ+=prizess
    return summ
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    summ = 0
    summ+=big_prizes (lot,all_prizes[:5])
    summ+=next_to_first (lot,all_prizes[5])
    summ+= digit_prizes (lot,all_prizes[6:])
    return summ

6632017821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_20.0
[0, 710, 071]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 053]
test_digit_prizes_20.0
[0, 0111]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 856, 'code+const': 1404}
def prize_check(lot,prize):
    money = 0
    for c in prize[-2::-1]:
        if c == lot:
            money += prize[-1]
    return money
def big_prizes(lot,prizes):
    money = 0
    for l in prizes:
        money += prize_check(lot,l)
    return money
def next_to_first(lot,prize):
    money = 0
    for c in prize[-2::-1]:
        num = int(c)
        if (int(lot)==(num+1)%1000000) or (int(lot)==(num-1)%1000000):
            money += prize[-1]
    return money
def first_digits_check(lot,prize):
    money = 0
    for c in prize[-2::-1]:
        if lot[0:3] == c:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    for c in prize[-2::-1]:
        if len(c)==2:
            if lot[-3:-1:1] == c:
                money += prize[-1]
        elif len(c)==3:
            if lot[-4:-1:1] == c:
                money += prize[-1]
    return money
def digit_prizes(lot,prizes):
    money = 0
    money += first_digits_check(lot,prizes[0])
    money += last_digits_check(lot,prizes[1])
    money += last_digits_check(lot,prizes[2])
    return money
def total_prize(lot,all_prizes):
    money = 0
    money += big_prizes(lot,all_prizes[0:5])
    money += next_to_first(lot,all_prizes[5])
    money += digit_prizes (lot,all_prizes[6:])
    return money

6632156321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 480, 'const': 584, 'code+const': 1064}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for i in prize:
                if lot == i:
                        total += prize[-1]
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for i in range (5):
               total += prize_check(lot, prizes[i])
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        num_before_first = int(prize[0]) - 1
        num_after_first = int(prize[0]) + 1
        total = 0
        if int(lot) == num_before_first:
            total = int(prize[1])
        if int(lot) == num_after_first:
            total = int(prize[1])
        return total
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for j in range(len(prize)-1):
                if prize[j] == lot[:3]:
                        total += prize[-1]
        return total
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        total = 0
        digit = len(prize[0])
        for i in range(len(prize)-1):
                if lot[-digit:] == prize[i]:
                      total += prize[-1]
        return total
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        total = last_digits_check(lot, all_prizes[8])
        total += first_digits_check(lot,all_prizes[6])
        return total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        total = digit_prizes(lot, all_prizes[6:])
        total += big_prizes(lot,all_prizes[:5])
        total += next_to_first(lot,all_prizes[5])
        return total

6632228921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 628, 'const': 908, 'code+const': 1536}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        lucky = prize[:-1]
        for i in lucky:
            if lot == i:
               money = money + prize[-1]
            else:
                pass
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for k in prizes:
                lucky = k[:-1]
                for i in lucky:
                        if lot == i:
                                money = money + k[-1]
                        else:
                                pass
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        if prize[0] == '999999':
                luckyplus = '000000'
                luckyminus = '999998'
        elif prize[0] == '000000':
                luckyplus = '000001'
                luckyminus = '999999'
        else:
                luckyplus = str(int(prize[0]) + 1)
                luckyminus = str(int(prize[0]) - 1)
        if lot == luckyplus or lot == luckyminus:
                money = money + prize[-1]
        return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        lucky = prize[:-1]
        for i in lucky:
            if lot[0:3] == i:
               money = money + prize[-1]
            else:
                pass
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        lucky = prize[:-1]
        money = 0
        if len(prize[0]) == 2:
                for i in lucky:
                        if lot[-2:] == i:
                                money = money + prize[-1]
                        else:
                                pass
        elif len(prize[0]) == 2:
                for i in lucky:
                        if lot[-3:] == i:
                                money = money + prize[-1]
                        else:
                                pass
        else:
                pass
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        money = first_digits_check(lot,prizes[0]) +                 last_digits_check(lot,prizes[1]) +                 last_digits_check(lot,prizes[2])
        return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        money = 0
        money = big_prizes(lot,all_prizes[:5]) +                 next_to_first(lot,all_prizes[5]) +                 digit_prizes (lot,all_prizes[6:])
        return money

6331507521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[9870, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 876, 'const': 744, 'code+const': 1620}
def prize_check(lot, prize):
    total_prize_money = 0
    # ตรวจสลากกับรางวัลที่ 1-5
    for i in range(len(prize)):
        if lot == prize[i]:  # ถ้าหมายเลขสลากตรงกับรางวัลที่ i
            total_prize_money += int(prize[-1])
    return total_prize_money
#------------------------------------
# ตรวจรางวัลใหญ่รวม
def big_prizes (lot,prizes):
    total_prize_money = 0
    # ตรวจสลากกับรางวัลที่ 1-5
    for i in range(len(prizes)):
        for j in prizes[i]:
            if lot == j:
                total_prize_money += prizes[i][-1]
    return total_prize_money
# ---------------------------------
# ตรวจรางวัลข้างเคียงรางวัลที่ 1
def next_to_first (lot,prize):
    total_prize_money = 0
    for i in range(len(prize)-1):
        Side_prizes1 = int(prize[i]) - 1
        Side_prizes2 = int(prize[i]) + 1
        if int(lot) == Side_prizes1 or Side_prizes2  :
            total_prize_money += int(prize[-1])
    return total_prize_money
# ---------------------------
# ตรวจรางวัลเลขหน้า 3 ตัว------------------
def first_digits_check(lot,prize):
    total_prize_money = 0
    for i in range(len(prize)):
        if lot[0:3] == prize[i]:
            total_prize_money += int(prize[-1])
    return total_prize_money
#----------------------------------------------
# ตรวจรางวัลเลขท้าย 2 ตัว
def last_digits_check(lot,prize):
    total_prize_money = 0
    for i in range(len(prize)):
        if lot[4:] == prize[i]:
            total_prize_money += int(prize[-1])
    return total_prize_money
#----------------------------------------------
# ตรวจรางวัลเลขหน้าและเลขท้ายรวม--------------
def digit_prizes (lot,prizes):
    total_prize_money = 0
    for i in range(len(prizes)):
        for j in prizes[i]:
            if lot[0:3] == j :  #เลขท้าย 3
                total_prize_money += int(prizes[i][-1])
            elif lot[3:] == j : #เลขหน้า 3
                total_prize_money += int(prizes[i][-1])
            elif lot[4:] == j : #เลขท้าย 2
                total_prize_money += int(prizes[i][-1])
    return total_prize_money
def total_prize (lot,all_prizes):
    total_prize_money = 0
    Side_prizes1  = int(all_prizes[5][0]) - 1
    Side_prizes2  = int(all_prizes[5][0]) + 1
    # กรณีรางวัลที่ 1
    for i in range(len(all_prizes[0])):
        if lot == all_prizes[i][0]:  # กรณีรางวัลที่ 1
            total_prize_money += int(all_prizes[0][-1])
        else:
    # รางวัลข้างเคียงรางวัลที่ 1
    if int(lot) == Side_prizes1 or int(lot) == int(Side_prizes2) :
            total_prize_money += int(all_prizes[5][-1])
    for i in range(len(all_prizes)):
        for j in all_prizes[i]:
            if lot[0:3] == j :  #เลขท้าย 3 ['555', '666', 4000]
                total_prize_money += int(all_prizes[i][-1])
            elif lot[3:] == j : #เลขหน้า 3 ['777', '888', 4000]
                total_prize_money += int(all_prizes[i][-1])
            elif lot[4:] == j : #เลขท้าย 2 ['55', 2000]]
                total_prize_money += int(all_prizes[i][-1])
            elif lot == j:# ตรวจรางวัลที่ 4
                total_prize_money += all_prizes[i][-1]
    return total_prize_money

6530110021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0NameError("name 'all_prizes' is not defined")
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0NameError("name 'all_prizes' is not defined")
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1788, 'const': 1248, 'code+const': 3036}
def prize_check (lot,prize):
  total = 0
  c = 0
  l = []
  for i in prize:
     if lot == i:
        c +=1
        l += [i]
     else:
         c +=0
         l +=[i]
  total += c*l[-1]
  c = 0
  l = []
  return total
def big_prizes (lot,prizes):
 total = 0
 c      = 0
 l       = []
 for i in prizes :
     if lot in i:
        for k in i:
            if k == lot:
                c +=1
                l +=[k]
            else:
                c +=0
                l +=[k]
        total += c*l[-1]
        c = 0
        l = []
 return total
def next_to_first (lot,prize):
 total = 0
 c = 0
 l = []
 for i in prize:
     if int(lot) == int(i)-1 or int(lot) == int(i)+1 :
        c += 1
        l += [i]
     if int(i) == 999999:
         if int(lot) == 999998 or int(lot) == 000000:
          c +=1
          l +=[i]
         else:
             c +=0
             l +=[i]
     else:
         c +=0
         l +=[i]
 total += c*l[-1]
 c = 0
 l = []
 return total
def first_digits_check(lot,prize):
  total = 0
  c = 0
  l = []
  for i in prize:
     if lot[0:3:1] == i:
        c +=1
        l += [i]
     else:
         c +=0
         l +=[i]
  total += c*l[-1]
  c = 0
  l = []
  return total
def last_digits_check(lot,prize):
 total = 0
 c = 0
 l = []
 for i in prize:
     if lot[-3::1] == i:
        c +=1
        l += [i]
     else:
         c +=0
         l +=[i]
 total += c*l[-1]
 c = 0
 l = []
 for i in prize:
    if lot[-2::1] == i:
        c +=1
        l +=[i]
    else:
        c +=0
        l += [i]
 total += c*l[-1]
 return total
def digit_prizes (lot,prizes):
 total = 0
 c      = 0
 l       = []
 k      = []
 z       = 6
 for i in all_prizes[6::]:
        k += i
        if z == 6:
         for e in k:
            if lot[0:3:1] == e:
                c +=1
                l +=[e]
            else:
                c +=0
                l +=[e]
         total += c*l[-1]
         c = 0
         l = []
         k = []
        if z == 7:
            for e in k:
                if lot[-3::1] == e:
                    c +=1
                    l +=[e]
                else:
                    c +=0
                    l +=[e]
            total += c*l[-1]
            c = 0
            l = []
            k = []
        if z == 8:
            for e in k:
                if lot[-2::1] == e:
                    c +=1
                    l +=[e]
                else:
                    c +=0
                    l +=[e]
            total += c*l[-1]
            c = 0
            l = []
            k = []
        z += 1
 return total
def total_prize (lot,all_prizes):
 c = 0
 total = 0
 l = []
 k = []
 z = 0
 for i in all_prizes:
        k += i
        if z < 5:
            for e in k:
                if lot == e:
                    c +=1
                    l +=[e]
                else:
                    c +=0
                    l +=[e]
            total += c*l[-1]
            c = 0
            l = []
            k = []
        if z == 5:
         for e in k:
          if int(lot) == int(e)-1 or int(lot) == int(e)+1 :
            c += 1
            l += [e]
          if int(lot) == 999999:
           if int(lot) == 999998 or int(lot) == 000000:
            c +=1
            l +=[e]
           else:
             c +=0
             l +=[e]
          else:
           c +=0
           l +=[e]
         total += c*l[-1]
         c = 0
         l = []
         k = []
        if z == 6:
         for e in k:
            if lot[0:3:1] == e:
                c +=1
                l +=[e]
            else:
                c +=0
                l +=[e]
         total += c*l[-1]
         c = 0
         l = []
         k = []
        if z == 7:
            for e in k:
                if lot[-3::1] == e:
                    c +=1
                    l +=[e]
                else:
                    c +=0
                    l +=[e]
            total += c*l[-1]
            c = 0
            l = []
            k = []
        if z == 8:
            for e in k:
                if lot[-2::1] == e:
                    c +=1
                    l +=[e]
                else:
                    c +=0
                    l +=[e]
            total += c*l[-1]
            c = 0
            l = []
            k = []
        z += 1
 return total

6531408221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 566, 'const': 854, 'code+const': 1420}
def prize_check (lot,prize):
  money = 0
  for e in prize[:-1]:
    if lot == e:
      money += prize[-1]
  return money
def big_prizes (lot,prizes):
  money = 0
  for e in prizes:
    money += prize_check(lot, e) #เรียกใช้ฟังก์ชันที่เขียนไว้แล้วเพื่อเช็คทีละรางวัล
  return money
def next_to_first (lot,prize):
  money = 0
  if prize[0] == '000000':
    if lot in ['000001','999999']:
      money += prize[1]
  elif prize[0] == '999999':
      if lot in ['000000','999998']:
        money  += prize[1]
  else:
      if abs(int(lot) - int(prize[0])) == 1:
        money += prize[1]
  return money
def first_digits_check(lot,prize):
  money = 0
  for e in prize[:-1]:
    if lot[0:3] == e:
      money += prize[-1]
  return money
def last_digits_check(lot,prize):
  money = 0
  for e in prize[:-1]:
    if len(e) == 2:
      if lot[-2:] == e :
        money += prize[-1]
      elif len(e) == 3:
        if lot[-3:] == e:
          money += prize[-1]
  return money
def digit_prizes (lot,prizes):
  money = 0
  for i in range(len(prizes)):
    if i == 0:
      money += first_digits_check(lot,prizes[i])
    else:
      money += last_digits_check(lot,prizes[i])
  return money
def total_prize (lot,all_prizes):
  money = big_prizes(lot,all_prizes[0:5:1]) + digit_prizes(lot,all_prizes[-3:]) + next_to_first(lot,all_prizes[5])
  return money

6531503121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 850, 'const': 776, 'code+const': 1626}
def prize_check (lot,prize):
    n = 0
    for e in prize[:-1] :
        if lot in e :
            n += 1
    out = prize[-1]*n
    return out
def big_prizes (lot,prizes):
    pay = 0
    for e in all_prizes:
        n = 0
        for e2 in e[:-1] :
            if lot == e2 :
                n += 1
        pay += int(e[-1])*n
    return pay
def next_to_first (lot,prize):
    pay = 0
    lot = int(lot)
    for e in prize[:-1]:
        if int(e) == 999999:
            if lot ==999998 or lot == 000000:
                pay += int(prize[-1])
                break
            if lot == int(e)-1:
                pay += int(prize[-1])
            if lot == int(e)+1:
                pay += int(prize[-1])
        if int(e) == 000000:
            if lot == 999999 or lot == 1 :
                pay += int(prize[-1])
                break
            if lot == int(e)-1:
                pay += int(prize[-1])
            if lot == int(e)+1:
                pay += int(prize[-1])
        else:
            if lot == int(e)-1:
                pay += int(prize[-1])
            if lot == int(e)+1:
                pay += int(prize[-1])
    return pay
def first_digits_check(lot,prize):
    lot = list(lot)
    pay = 0
    for e in prize[:-1]:
        if lot[:3] == list(e):
            pay += prize[-1]
    return pay
def last_digits_check(lot,prize):
    lot = list(lot)
    pay = 0
    for e in prize[:-1]:
        if len(e) == 2:
            if list(e) == lot[4:]:
                pay += prize[-1]
                break
        if len(e) == 3:
            if list(e) == lot[3:]:
                pay += prize[-1]
    return pay
def digit_prizes (lot,prizes):
    x = first_digits_check(lot,prizes[0])
    y = last_digits_check(lot,prizes[1])
    out = x+y
    out += last_digits_check(lot,prizes[2])
    return out
def total_prize (lot,all_prizes):
    y = big_prizes (lot,all_prizes[:5])
    z = next_to_first (lot,all_prizes[5])
    v = digit_prizes (lot,all_prizes[6:])
    out = y+z+v
    return out

6531519221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 604, 'code+const': 1152}
def prize_check(lot, prize):
    reward = 0
    for i in prize[:-1]:
        if lot == i:
            reward += prize[-1]
    return reward
def big_prizes(lot, prizes):
    reward = 0
    for i in range(len(prizes)):
        r = prize_check(lot, prizes[i])
        reward += r
    return reward
def next_to_first(lot, prizes):
    reward = 0
    lot = int(lot) + 1
    r = prize_check(str(lot), prizes)
    reward += r
    lot = int(lot) - 2
    r = prize_check(str(lot), prizes)
    reward += r
    return reward
def first_digits_check(lot, prizes):
    reward = 0
    r = prize_check(lot[:3], prizes)
    reward += r
    return reward
def last_digits_check(lot, prizes):
    reward = 0
    for i in prizes[:-1]:
        if lot[3:] == i or lot[4:] == i:
            reward += prizes[-1]
    return reward
def digit_prizes(lot, prizes):
    reward = 0
    for i in range(len(prizes)):
        if i == 0:
            r = first_digits_check(lot, prizes[0])
            reward += r
        if i == 1:
            r = prize_check(lot, prizes[1])
            reward += r
        if i == 2:
            r = last_digits_check(lot, prizes[2])
            reward += r
    return reward
def total_prize(lot, all_prizes):
    reward = 0
    reward += big_prizes(lot, all_prizes[:5])
    reward += next_to_first(lot, all_prizes[5])
    reward += digit_prizes(lot, all_prizes[6:])
    return reward

6630004221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[710883]
test_big_prizes_20.0
[710883]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 682, 'const': 1021, 'code+const': 1703}
def prize_check (lot,prize):
        totalmoney = 0
        eachreward = prize[-1]
        for i in range(len(prize)-1):
            if lot == prize[i]:
                   totalmoney += eachreward
        return totalmoney
def big_prizes (lot,prizes):
    totalmoney = 0
    for i in range(4):
          eachprizes = prizes[i]
          eachreward = eachprizes[-1]
          for j in range(len(eachprizes)-1):
                if lot == eachprizes[j]:
                      totalmoney += eachreward
    return totalmoney
def next_to_first (lot,prize):
    totalmoney = 0
    eachreward = prize[-1]
    #1
    firstnumber = str(int(prize[0]) - 1)
    if firstnumber == '-1':
          firstnumber = '999999'
    #2
    secondnumber = str(int(prize[0]) + 1)
    if secondnumber == '1000000':
          secondnumber = '000000'
    if lot == firstnumber:
        totalmoney += eachreward
    elif lot == secondnumber:
        totalmoney += eachreward
    return totalmoney
def first_digits_check(lot,prize):
     totalmoney = 0
     lotfirst3 = lot[:3]
     eachreward = prize[-1]
     for i in range(len(prize)-1):
          if prize[i] == lotfirst3:
               totalmoney += eachreward
     return totalmoney
def last_digits_check(lot,prize):
    totalmoney = 0
    eachreward = prize[-1]
    if len(prize[0]) == 2:
        lotlast2 = lot[4:]
        for i in range(len(prize)-1):
             if lotlast2 == prize[i]:
                totalmoney += eachreward
    elif len(prize[0]) == 3:
        lotlast3 = lot[3:]
        for i in range(len(prize)-1):
             if lotlast3 == prize[i]:
                totalmoney += eachreward
    return totalmoney
def digit_prizes (lot,prizes):
     moneyfromfirst3 = first_digits_check(lot,prizes[0])
     moneyfromlast3 = last_digits_check(lot,prizes[1])
     moneyfromlast2 = last_digits_check(lot,prizes[2])
     totalmoney = moneyfromfirst3 + moneyfromlast3 + moneyfromlast2
     return totalmoney
def total_prize (lot,all_prizes):
    moneyfrombigprize = big_prizes(lot,all_prizes[:5])
    moneyfromnexttofirst = next_to_first(lot, all_prizes[5])
    moneyfromdigitprize = digit_prizes(lot,all_prizes[6:])
    totalmoney = moneyfrombigprize + moneyfromnexttofirst + moneyfromdigitprize
    return totalmoney

6630014521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_20.0
[0, 710, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 524, 'const': 716, 'code+const': 1240}
def prize_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        m = 0
        e = 1
        while e < len(prize) :
          if lot == prize[e-1] :
            m += prize[-1]
          e += 1
        return m
def big_prizes(lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        m = 0
        e = 1
        prize = prizes
        for i in range(len(prizes)) :
          m += prize_check(lot,prize[i])
        return m
def next_to_first(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        n1,n2 = str((int(prize[0])+999999)%1000000),str((int(prize[0])+1000001)%100000)
        if lot == n1 or lot == n2 :
          return prize[1]
        else :
          return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        m = 0
        for e in prize[:-1] :
          if e == lot[:3] :
            m += prize[-1]
        return m
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        m = 0
        for e in prize[:-1] :
          if e in lot[3:] :
            m += prize[-1]
        return m
def digit_prizes(lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        prize = prizes
        m = first_digits_check(lot,prize[0])
        for i in range(len(prize)-1):
          m += last_digits_check(lot,prize[i+1])
        return m
def total_prize(lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        m = 0
        m += big_prizes (lot,all_prizes[:5])
        m += next_to_first (lot,all_prizes[5])
        m += digit_prizes (lot,all_prizes[6:])
        return m

6630024821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[9870, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 842, 'const': 1020, 'code+const': 1862}
def prize_check (lot,prize):
    x = 0
    for i in range(len(prize)) :
        if lot == prize[i] :
            x+=prize[-1]
    return x
def big_prizes (lot,prizes):
    x = 0
    for i in range(5) :
        if lot in prizes[i] :
            for j in range(len(prizes[i])-1) :
                if lot == prizes[i][j] :
                    a = prizes[i][-1]
                    x +=a
    return x
def next_to_first (lot,prize):
    if prize[0] == '999999' :
        p1 = '999998' ; p2 = '000000'
    elif prize[0] == '000000' :
        p1 = '999999' ; p2 = '000001'
    else :
        p1 = str(int(prize[0])-1) ; p2 =str(int(prize[0])+1)
    if lot == p1 or p2 :
        return prize[-1]
    else : return 0
def first_digits_check(lot,prize):
    x = lot[:3] ; a = 0
    for i in range(len(prize)) :
        if x == prize[i] : a+=prize[-1]
    return a
def last_digits_check(lot,prize):
    x = lot[-2:] ; a = 0 ; y = lot[-3:] ; b = 0
    for i in range(len(prize)) :
        if x == prize[i] : a+=prize[-1]
    for j in range(len(prize)) :
        if y == prize[j] : b+=prize[-1]
    return a + b
def digit_prizes (lot,prizes):
    x = lot[:3]; y = lot[-2:]; a = 0
    for i in range(len(prizes)):
        if x in prizes[i] :
            for j in range(len(prizes[i])-1) :
                if x in prizes[i][j] : a+= prizes[i][-1]
    for k in range(len(prizes)):
        if y in prizes[k] :
            for g in range(len(prizes[k])-1) :
                if y in prizes[k][g] : a+= prizes[k][-1]
    return a
def total_prize (lot,all_prizes):
    a=0
    for i in range(len(all_prizes)) :
        if lot in all_prizes[i]:
            for j in range(len(all_prizes[i])-1):
                if lot in all_prizes[i][j] :
                    a+=all_prizes[i][-1]
    b = digit_prizes (lot,all_prizes)
    c = next_to_first (lot,all_prizes[5])
    return a+b+c

6630033421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[710883]
test_big_prizes_20.0
[710883]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 630, 'const': 716, 'code+const': 1346}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  sum=0
  for i in range(len(prize)-1):
    if lot==prize[i]:
      sum+=prize[len(prize)-1]
  return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  sum=0
  for i in range(len(prizes)-1):
    sum+=prize_check(lot,prizes[i])
  return sum
def next_to_first(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  left_lot=str(int(prize[0])-1).zfill(6)
  right_lot=str(int(prize[0])+1).zfill(6)
  if lot==left_lot or lot==right_lot:
    return prize[1]
  else:
    return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  lot=int(lot)//1000
  sum=0
  for i in range(len(prize)-1):
    if lot==int(prize[i]):
      sum+=prize[len(prize)-1]
  return sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  last3lot=int(lot)%1000
  last2lot=int(lot)%100
  sum=0
  for i in range(len(prize)-1):
    if len(prize[i])==2:
      if last2lot==int(prize[i]):
        sum+=prize[len(prize)-1]
    elif len(prize[i])==3:
      if last3lot==int(prize[i]):
        sum+=prize[len(prize)-1]
  return sum
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  sum=0
  sum+=first_digits_check(lot,prizes[0])
  sum+=last_digits_check(lot,prizes[1])
  sum+=last_digits_check(lot,prizes[2])
  return sum
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  sum=0
  sum+=big_prizes(lot,all_prizes)
  sum+=next_to_first(lot,all_prizes[5])
  sum+=digit_prizes(lot,all_prizes[6:])
  return sum

6630036321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 536, 'const': 688, 'code+const': 1224}
def prize_check(lot, prize): # ตรวจรางวัลใหญ่
    sum = 0
    for i in range(len(prize)) :
        if lot == prize[i] :
            sum += prize[-1]
    return sum
# *************************************************** #
def big_prizes(lot,prizes): # ตรวจรางวัลใหญ่รวม
    sum_big = 0
    for prize_set in prizes :
        sum_big += prize_check(lot, prize_set)
    return sum_big
# *************************************************** #
def next_to_first(lot,prize): # ตรวจรางวัลข้างเคียงรางวัลที่ 1
    str_to_int = [int(e) for e in prize]
    next_to_1st = [str(str_to_int[0]-1), str(str_to_int[0]+1)]
    sum_next_to = 0
    for next_to in next_to_1st :
        if lot == next_to :
            sum_next_to += prize[-1]
    return sum_next_to
# *************************************************** #
def first_digits_check(lot,prize): # ตรวจรางวัลเลขหน้า 3 ตัว
    first_digits = [prize[0], prize[1]]
    sum_first_digits = 0
    for fi_digit in first_digits :
        if lot[:3] == fi_digit :
            sum_first_digits += prize[-1]
    return sum_first_digits
# *************************************************** #
def last_digits_check(lot,prize): # ตรวจรางวัลเลขท้าย 3 ตัวหรือ 2 ตัว
    sum_last_digits = 0
    last_three_digits = [prize[0], prize[1]]
    for la_thr_digit in last_three_digits :
        if lot[3:] == la_thr_digit :
            sum_last_digits += prize[-1]
    if lot[4:] == prize[0] :
        sum_last_digits += prize[-1]
    return sum_last_digits
# *************************************************** #
def digit_prizes(lot,prizes): # ตรวจรางวัลเลขหน้าและเลขท้ายรวม
    sum_digit = 0
    sum_digit += first_digits_check(lot,prizes[0])                  + last_digits_check(lot,prizes[1])                  + last_digits_check(lot,prizes[2])
    return sum_digit
# *************************************************** #
def total_prize(lot,all_prizes): # ตรวจรวมทุกรางวัล
    sum_total = 0
    sum_total += big_prizes(lot,all_prizes[:5])                  + next_to_first(lot,all_prizes[5])                  + digit_prizes(lot,all_prizes[6:])
    return sum_total
# *************************************************** #

6630082121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_20.0
[0, 53111]
test_total_prize1.0
[186005]
bytecount: {'code': 526, 'const': 820, 'code+const': 1346}
def prize_check (lot,prize):
    total = 0
    for win in prize:
        if lot == win:
            total += prize[-1]
    return total
def big_prizes (lot,prizes):
    total = 0
    for prize in prizes:
        total += prize_check(lot, prize)
    return total
def next_to_first (lot,prize):
    total = 0
    first_next = "000000" if lot == "999999" else str(int(lot) + 1)
    second_next = "999999" if lot == "000000" else str(int(lot) - 1)
    first_next = "0"*(6-len(first_next)) + first_next
    second_next = "0"*(6-len(second_next)) + second_next
    for win in prize:
        if first_next == win or second_next == win:
            total += prize[-1]
    return total
def first_digits_check(lot,prize):
    total = 0
    first_three = lot[:3]
    for win in prize:
        if first_three == win:
            total += prize[-1]
    return total
def last_digits_check(lot,prize):
    total = 0
    last_three = lot[4:]
    last_two = lot[5:]
    for win in prize:
        if last_three == win or last_two == win:
            total += prize[-1]
    return total
def digit_prizes (lot,prizes):
    total = 0
    total += first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[-1]) + last_digits_check(lot, prizes[-2])
    return total
def total_prize (lot,all_prizes):
    total = 0
    total += big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
    return total

6630185121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 740, 'const': 660, 'code+const': 1400}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        rank = 0
        for i in range(len(prize)-1):
            if lot == prize[i]:
              rank += prize[len(prize)-1]
        return rank
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        toprank = 0
        for i in range(len(prizes)):
            toprank += prize_check(lot,prizes[i])
        return toprank
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        prize_next = int(prize[0])
        next_rank = 0
        if (prize_next == 0):
            if(int(lot) == 999999):
                next_rank += prize[len(prize)-1]
                if (prize_next+1 == int(lot)):
                    next_rank += prize[len(prize)-1]
        else:
         if (prize_next-1 == int(lot)):
          next_rank += prize[len(prize)-1]
         if (prize_next+1 == int(lot)):
            next_rank+= prize[len(prize)-1]
        return next_rank
def first_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        first_rank = 0
        for i in range(len(prize)-1):
            if lot[0:3] == prize[i]:
             first_rank += prize[len(prize)-1]
        return first_rank
def last_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        last_rank = 0
        for i in range(len(prize)-1):
         if lot[4:6] == prize[i]:
            last_rank += prize[len(prize)-1]
        return last_rank
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        rank_digit = 0
        for i in range(len(prizes)):
          count = prizes[i]
          for x in range(len(prizes[i])-1):
            if lot[0:3] == count[x]:
                rank_digit += count[len(count)-1]
            if lot[4:6] == count[x]:
                rank_digit += count[len(count)-1]
        return rank_digit
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        rank_total = 0
        for i in range(len(all_prizes)):
          if 5 > i:
            rank_total += prize_check(lot, all_prizes[i])
          else:
              rank_total += next_to_first(lot,all_prizes[i])
              rank_total += first_digits_check(lot,all_prizes[i])
              rank_total += last_digits_check(lot,all_prizes[i])
        return rank_total

6630268621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 740, 'const': 660, 'code+const': 1400}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        count = 0
        for i in range(len(prize)-1):
          if lot == prize[i]:
            count += prize[len(prize)-1]
        return count
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        countbig = 0
        for i in range(len(prizes)):
          countbig += prize_check(lot, prizes[i])
        return countbig
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        nextprize = int(prize[0])
        countnext = 0
        if (nextprize == 0):
          if (int(lot) == 999999):
            countnext += prize[len(prize)-1]
          if (nextprize+1 == int(lot)):
            countnext += prize[len(prize)-1]
        else:
          if (nextprize-1 == int(lot)):
            countnext += prize[len(prize)-1]
          if (nextprize+1 == int(lot)):
            countnext += prize[len(prize)-1]
        return countnext
def first_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        countfirst = 0
        for i in range(len(prize)-1):
          if lot[0:3] == prize[i]:
            countfirst += prize[len(prize)-1]
        return countfirst
def last_digits_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        countlast = 0
        for i in range(len(prize)-1):
          if lot[4:6] == prize[i]:
            countlast += prize[len(prize)-1]
        return countlast
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        countdigit = 0
        for i in range(len(prizes)):
          temp = prizes[i]
          for j in range(len(prizes[i])-1):
            if lot[0:3] == temp[j]:
              countdigit += temp[len(temp)-1]
            if lot[4:6] == temp[j]:
              countdigit += temp[len(temp)-1]
        return countdigit
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของทุกรางวัลที่ออก
        counttotal = 0
        for i in range(len(all_prizes)):
          if i < 5:
            counttotal += prize_check(lot, all_prizes[i])
          else:
            counttotal += next_to_first(lot, all_prizes[i])
            counttotal += first_digits_check(lot, all_prizes[i])
            counttotal += last_digits_check(lot, all_prizes[i])
        return counttotal

6631004421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[0, 0987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 466, 'const': 752, 'code+const': 1218}
def prize_check (lot,prize):
    money = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
    money = 0
    for prize in prizes:
        money += prize_check(lot,prize)
    return money
def next_to_first (lot,prize):
    if prize[0] == '000000':
        if lot == '000001' or lot == '999999':
            return prize[-1]
        else:
            return 0
    elif prize[0] == '999999':
        if lot == '999998' or lot == '000000':
            return prize[-1]
        else:
            return 0
    else:
        if int(lot) == int(prize[0])+1 or int(prize[0])-1:
            return prize[-1]
        else:
            return 0
def first_digits_check(lot,prize):
    money = prize_check(lot[:3],prize)
    return money
def last_digits_check(lot,prize):
    if len(prize) == 3:
        return prize_check(lot[3:],prize)
    else:
        return prize_check(lot[4:],prize)
def digit_prizes (lot,prizes):
    return first_digits_check(lot,prizes[0]) +             last_digits_check(lot,prizes[1]) +             last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
    return big_prizes(lot,all_prizes[:5]) +             next_to_first(lot,all_prizes[5]) +             digit_prizes(lot,all_prizes[6:])

6631018221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 16911]
test_total_prize0.0
[2701860085]
bytecount: {'code': 584, 'const': 664, 'code+const': 1248}
def prize_check (lot,prize):
        m = 0
        for i in prize:
          if lot == i :
            m+= prize[-1]
        return m
def big_prizes (lot,prizes):
        m = 0
        for i in prizes:
          for k in i  :
            if lot == k :
              m+= i[-1]
        return m
def next_to_first (lot,prize):
        m = 0
        x = int(prize[0])
        nearp = str(x+1)
        nearm = str(x-1)
        if lot in nearp:
          m += prize[-1]
        elif lot in nearm:
          m += prize[-1]
        return m
def first_digits_check(lot,prize):
        m = 0
        for i in prize :
          if lot[:3] == i:
            m+= prize[-1]
        return m
def last_digits_check(lot,prize):
        m = 0
        for i in prize:
          if lot[3:] == i:
            m += prize[-1]
          elif lot[4:] == i:
            m += prize[-1]
        return m
def digit_prizes (lot,prizes):
        m = 0
        for i in  prizes:
          for x in i:
            if lot[:3]==x:
              m+=i[-1]
            if lot [3:]==x:
              m+=i[-1]
            if lot[4:] == x:
              m+=i[-1]
        return m
def total_prize (lot,all_prizes):
        p1 = big_prizes(lot,all_prizes)
        p2 = big_prizes(lot,all_prizes[:5])
        p3 = next_to_first(lot,all_prizes[5])
        p4 = first_digits_check(lot,all_prizes)
        p5 = last_digits_check(lot,all_prizes)
        p6 = digit_prizes(lot,all_prizes[6:])
        return p1+p2+p3+p4+p5+p6

6631028521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 584, 'const': 770, 'code+const': 1354}
def prize_check (lot,prize):
    k = 0
    for p in prize[:-1]:
        if lot == p:
            k += prize[-1]
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prize):
    k = 0
    for p in range(len(prize)):
        k += prize_check(lot,prize[p])
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    k = 0
    if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0]) - 1:
        k += prize[-1]
    elif prize[0] == "999999":
        if lot == "999999" or lot == "000000":
           k += prize[-1]
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    k = 0
    for p in range(len(prize)-1):
        if lot[:3] == prize[p]:
           k += prize[-1]
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    k = 0
    if len(prize[0])==3 :
      if lot[-3:] == prize[0] or lot[-3:] == prize[1]:
        k+= prize[-1];
    if lot[-2:] == prize[0] :
        k += prize[-1]
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes(lot, prize):
    k = 0
    for p in range(len(prize)):
        if p == 0:
            k += first_digits_check(lot, prize[p])
        else:
            k += last_digits_check(lot, prize[p])
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize(lot,all_prizes):
  k = 0
  k += big_prizes(lot, all_prizes[0:5]) + next_to_first(lot, all_prizes[5])+digit_prizes(lot, all_prizes[6:])
  return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
# ตัวอย่าง

6631126321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 0987, 987]
test_next_to_first_20.0
[0, 987, 987, 0987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 572, 'const': 798, 'code+const': 1370}
def prize_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot :
      sum += prize[-1]
  return sum
def big_prizes(lot,prize):
  sum = 0
  for i in prize:
    for j in range(len(i)-1):
      if i[j] == lot:
        sum += i[-1]
  return sum
def next_to_first(lot,prize):
  p = int(prize[0])
  b = str((p-1 + 1000000)%1000000)
  a = str((p+1 + 1000000)%1000000)
  while(len(b) < 6):
    b = '0' + b
  while(len(a) < 6):
    a= '0' + a
    if lot == b:
     return prize[1]
  if lot == a:
    return prize[1]
  return 0
def first_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[:3] :
      sum += prize[-1]
  return sum
def last_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[(6-len(prize[i])):] :
      sum += prize[-1]
  return sum
def digit_prizes(lot,prizes):
  return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6631137221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 100000987, 100000987]
test_next_to_first_20.0
[0, 0987, 0987, 100000987, 100000987, 100000987, 100000987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 816, 'const': 1328, 'code+const': 2144}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in prize[:-1]:
        if lot in i:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    big_prizes_sum = 0
    for i in prizes:
        for j in i[:-1]:
            if lot in j:
                big_prizes_sum += i[-1]
    return big_prizes_sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    next_to_sum = 0
    for i in prize[:-1]:
        if i == "000000":
            if lot in ["000001", "999999"]:
                next_to_sum += 100000
        elif i == "999999":
            if lot in ["000000", "999998"]:
                next_to_sum += 100000
        elif lot == str(int(i) + 1) or lot == str(int(i) - 1):
            next_to_sum += 100000
    return next_to_sum
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    first_digits_sum = 0
    for i in prize[:-1]:
        if lot[:3] in i:
            first_digits_sum += prize[-1]
    return first_digits_sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    last_digits_sum = 0
    for i in prize[:-1]:
        if lot[3:] in i or lot[4:] in i:
            last_digits_sum += prize[-1]
    return last_digits_sum
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    first_digits_sum = 0
    for i in prizes[0][:-1]:
        if lot[:3] in i:
            first_digits_sum += prizes[0][-1]
    last_digits_sum = 0
    for i in prizes[1:]:
        for j in i[:-1]:
            if lot[3:] in j or lot[4:] in j:
                last_digits_sum += i[-1]
    return last_digits_sum + first_digits_sum
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    big_prizes_sum = 0
    for i in all_prizes[:5]:
        for j in i[:-1]:
            if lot in j:
                big_prizes_sum += i[-1]
    next_to_sum = 0
    for i in all_prizes[5][:-1]:
        if i == "000000":
            if lot in ["000001", "999999"]:
                next_to_sum += 100000
        elif i == "999999":
            if lot in ["000000", "999998"]:
                next_to_sum += 100000
        elif lot == str(int(i) + 1) or lot == str(int(i) - 1):
            next_to_sum += 100000
    first_digits_sum = first_digits_check(lot, all_prizes[6])
    last_digits_sum = last_digits_check(lot, all_prizes[7])
    last_digits_sum += last_digits_check(lot, all_prizes[8])
    return big_prizes_sum + first_digits_sum + last_digits_sum + next_to_sum

6631202321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 946, 'const': 1061, 'code+const': 2007}
def list_lot(lot, num, FB) :
  a = list(lot)
  p = 6 - num
  if FB == "F" :
    loop = 0
    while loop < p :
      a.pop(-1)
      loop += 1
    return a
  if FB == "B" :
    loop2 = 0
    while loop2 < p :
      a.pop(0)
      loop2 += 1
    result = "".join(a)
    return result
def prize_check(lot,prize) :
  x = [int(x) for x in prize]
  check = int(lot)
  a = len(prize) - 1
  loop = 0
  sum = 0
  while loop < a :
    if check == x[loop] :
      sum += x[-1]
    else :
      sum += 0
    loop += 1
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes(lot,prizes) :
  y = [list(x) for x in prizes]
  a = len(y)
  loop = 0
  sum = 0
  while loop < a :
    t = y[loop]
    s = prize_check(lot,t)
    sum += s
    loop += 1
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize) :
  x1,x2 = list(prize)
  check = int(lot)
  sum = 0
  min = int(x1) - 1
  max = int(x1) + 1
  if check == min or check == max :
    sum += int(x2)
  else :
    sum += 0
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize) :
  y = [str(x) for x in prize]
  check = "".join(list_lot(lot, 3, "F"))
  a = len(y) - 1
  loop = 0
  sum = 0
  while loop < a :
    if check == y[loop] :
      sum += int(y[-1])
    else :
      sum += 0
    loop += 1
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize) :
  y = [str(x) for x in prize]
  check = "".join(list_lot(lot, 2, "B"))
  a = len(y) - 1
  loop = 0
  sum = 0
  while loop < a :
    if check == y[loop] :
      sum += int(y[-1])
    else :
      sum += 0
    loop += 1
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes) :
  x1,x2,x3 = list(prizes)
  sum1 = first_digits_check(lot, x1)
  sum2 = first_digits_check(lot, x2)
  sum3 = last_digits_check(lot, x3)
  result = sum1 + sum2 + sum3
  return result
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes) :
  s1 = big_prizes(lot,all_prizes[:5])
  s2 = next_to_first(lot, all_prizes[5])
  s3 = digit_prizes(lot, all_prizes[6:])
  result = s1 + s2 + s3
  return result
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631223521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 562, 'const': 992, 'code+const': 1554}
def prize_check (lot,prize):
    reward=0
    for i in range(len(prize)-1):
        if lot==prize[i]:
            reward+=prize[-1]
    return reward
def big_prizes (lot,prizes):
    reward=0
    for i in range(5):
        reward+=prize_check(lot,prizes[i])
    return reward
def next_to_first (lot,prize):
    reward=0
    n_f1=str(int(prize[0])+1)
    n_f2=str(int(prize[0])-1)
    if lot=='999999':
        n_f1='000000'
        n_f2='999998'
    elif lot=='000000':
        n_f1='000001'
        n_f2='999999'
    if lot==n_f1 or lot==n_f2:
        reward+=prize[-1]
    return reward
def first_digits_check(lot,prize):
    reward=0
    for i in  range(2):
        if lot[:3]==prize[i]:
            reward+=prize[-1]
    return reward
def last_digits_check(lot,prize):
    reward=0
    if len(prize[0])==3:
        for i in range(2):
            if lot[-3:]==prize[i]:
                reward+=prize[-1]
    else:
        if lot[-2:]==prize[0]:
            reward+=prize[-1]
    return reward
def digit_prizes (lot,prizes):
    reward=0
    reward+=first_digits_check(lot,prizes[0])
    reward+=last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
    return reward
def total_prize (lot,all_prizes):
    reward=0
    #reward+=prize_check (lot,prize[-1])
    reward+=big_prizes (lot,all_prizes)
    reward+=next_to_first (lot,all_prizes[5])
    reward+=digit_prizes (lot,all_prizes[6:])
    return reward

6631456421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[710883]
test_big_prizes_20.0
[710883]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 632, 'const': 912, 'code+const': 1544}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for i in prize[:-1]:
          if lot == i:
            sum += prize[-1]
        return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for i in range(0,4):
          a = prizes[i]
          for j in a[:-1]:
            if lot == j:
              sum += a[-1]
        return sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if prize[0] == '000000':
            up = '000001'
            down = '999999'
        elif prize[0] == '999999':
            up = '000000'
            down = '999998'
        else:
            up = int(prize[0]) + 1
            down = int(prize[0]) - 1
            up = str(up).zfill(6)
            down = str(down).zfill(6)
        if lot == up or lot == down:
            return prize[1]
        else:
            return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for j in prize[:-1]:
          if lot[:3] == j:
            sum += prize[-1]
        return sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        sum = 0
        if len(prize) == 3:
          for j in prize[:-1]:
            if lot[-3:] == j:
              sum += prize[-1]
        else:
          for j in prize[:-1]:
            if lot[-2:] == j:
              sum += prize[-1]
        return sum
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        a = first_digits_check(lot,prizes[0])
        b = last_digits_check(lot,prizes[1])
        c = last_digits_check(lot,prizes[2])
        return int(a)+int(b)+int(c)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a = big_prizes(lot,all_prizes[:5])
        b = next_to_first(lot,all_prizes[5])
        c = digit_prizes (lot,all_prizes[6:])
        return int(a)+int(b)+int(c)

6631523821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0NameError("name 'all_prizes' is not defined")
[0, 987, 987]
test_next_to_first_20.0NameError("name 'all_prizes' is not defined")
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 676, 'const': 692, 'code+const': 1368}
def prize_check (lot,prize):
    total = []
    for i in prize:
        if lot == i:
            total.append(prize[-1])
        else:
            total.append(0)
    return sum(total)
def big_prizes (lot,prizes):
    total = []
    for x in prizes:
        for i in x:
            if lot == i:
                total.append(x[-1])
            else:
                total.append(0)
    return sum(total)
def next_to_first (lot,prize):
    total = []
    x = str(int(all_prizes[0][0]) + 1)
    y = str(int(all_prizes[0][0]) - 1)
    if lot == x or lot == y:
        total.append(prize[-1])
    else:
        total.append(0)
    return sum(total)
def first_digits_check(lot,prize):
    total = []
    for i in prize:
        if lot[:3] == i:
            total.append(prize[-1])
        else:
            total.append(0)
    return sum(total)
def last_digits_check(lot,prize):
    total = []
    for i in prize:
        if lot[-3:] == i:
            total.append(prize[-1])
        elif lot[-2:] == i:
            total.append(prize[-1])
        else :
            total.append(0)
    return sum(total)
def digit_prizes (lot,prizes):
    total = []
    for i in prizes:
        for x in i:
            if lot[:3] == x:
                total.append(i[-1])
            elif lot[-3:] == x:
                total.append(i[-1])
            elif lot[-2:] == x:
                total.append(i[-1])
            else:
                total.append(0)
    return sum(total)
def total_prize (lot,all_prizes):
    total = []
    total.append(big_prizes(lot,all_prizes[:5]))
    total.append(next_to_first(lot,all_prizes[5]))
    total.append(digit_prizes (lot,all_prizes[6:]))
    return sum(total)

6631704021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0NameError("name 'all_prizes' is not defined")
[1083]
test_big_prizes_20.0NameError("name 'all_prizes' is not defined")
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prizes' is not defined")
[186005]
bytecount: {'code': 708, 'const': 1024, 'code+const': 1732}
def prize_check (lot,prize):
    m = 0
    for e in range(len(prize)-1):
        if lot == prize[e]:
            m += prize[-1]
        else:
            m += 0
    return m
def big_prizes (lot,prize):
    m = 0
    for e in range(5):
        for f in range(len(all_prizes[e])-1):
            if lot == all_prizes[e][f]:
                m += all_prizes[e][-1]
            else:
                m += 0
    return m
def next_to_first(lot,prize):
    lot = int(lot)
    p = int(prize[0])
    m = 0
    if p-lot==1 or p-lot==-1 or p-lot==999999 or p-lot==-999999:
        m += prize[-1]
    else :
        m += 0
    return m
def first_digits_check(lot,prize):
    m = 0
    f3d = lot[:3]
    for e in range(len(prize)-1):
        if f3d == prize[e]:
            m += prize[-1]
        else:
            m += 0
    return m
def last_digits_check(lot,prize):
    m = 0
    l3d = lot[-3:]
    l2d = lot[-2:]
    for e in range(len(prize)-1):
        if l3d == prize[e] or l2d == prize[e]:
            m += prize[-1]
        else:
            m+=0
    return m
def digit_prizes (lot,prize):
    f3d = lot[:3]
    l3d = lot[-3:]
    l2d = lot[-2:]
    m = 0
    m += first_digits_check(lot,prize[0])
    m += last_digits_check(lot,prize[1])
    m += last_digits_check(lot,prize[2])
    return m
def total_prize (lot,all_prizes):
    f3d = lot[:3]
    l3d = lot[-3:]
    l2d = lot[-2:]
    m = 0
    m += big_prizes(lot,all_prizes[:5])
    m += next_to_first(lot,all_prizes[5])
    m += digit_prizes(lot,all_prizes[6:])
    return m

6631809321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_10.0
[710883]
test_big_prizes_20.0
[710883]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 682, 'const': 936, 'code+const': 1618}
def prize_check(lot,prize):
    k=0
    for i in range(len(prize)-1):
        if lot==prize[i]:
            k+=prize[-1]
    return k
def big_prizes (lot,prizes):
    k=[]
    t=0
    for i in range(len(prizes)-1):
        k=prizes[i]
        for j in range(len(k)-1):
            if lot==k[j]:
                t+=k[-1]
        k=[]
    return t
def next_to_first(lot,prize):
    k=0
    u=[]
    a,b=prize
    if a=='000000':
        u=['000001','999999']
    elif a=='999999':
        u=['000000','999998']
    else:
        u=[str(int(a)+1),str(int(a)-1)]
    for i in range(len(u)):
        if lot==u[i]:
            k+=int(b)
    return k
def first_digits_check(lot,prize):
    u=lot[0]+lot[1]+lot[2]
    k=0
    for i in range(len(prize)-1):
        if u==prize[i]:
            k+=prize[-1]
    return k
def last_digits_check(lot,prize):
    u=0
    for i in prize[:-1]:
        if len(i)==3:
            if lot[-3:]==i:
                u+=prize[-1]
        elif len(i)==2:
            if lot[-2:]==i:
                u+=prize[-1]
        else:
            pass
    return u
def digit_prizes(lot,prizes):
    u=0
    for i in range(len(prizes)):
        if i==0:
            u+=first_digits_check(lot,prizes[i])
        else:
            u+=last_digits_check(lot,prizes[i])
    return u
def total_prize (lot,all_prizes):
    u=0
    u+=big_prizes(lot,all_prizes[:5])
    u+=next_to_first(lot,all_prizes[5])
    u+=digit_prizes(lot,all_prizes[6:])
    return u

6632029321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 5329, 5329, 53]
test_digit_prizes_20.0
[0, 15911]
test_total_prize1.0
[186005]
bytecount: {'code': 468, 'const': 632, 'code+const': 1100}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        m=0
        for i in prize:
          if i==lot:
            m+=prize[-1]
        return m
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        m=0
        for i in range(len(prizes)):
          m+=prize_check(lot,prizes[i])
        return m
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        m=0
        if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1):
          m+=prize[-1]
        return m
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
       m=0
       lot3=lot[0]+lot[1]+lot[2]
       m+=prize_check(lot3,prize)
       return m
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        lot3=lot[-3]+lot[-2]+lot[-1]
        lot2=lot[-2]+lot[-1]
        m=0
        m+=prize_check(lot3,prize)
        m+=prize_check(lot2,prize)
        return m
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        m=0
        m+=first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1]+prizes[2])
        return m
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        m=0
        m+=big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])+digit_prizes(lot,all_prizes[6:])
        return m

6632163721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0TypeError("unsupported operand type(s) for +=: 'int' and 'str'")
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 544, 'const': 744, 'code+const': 1288}
def prize_check(lot,prize):
  x = 0
  for i in range(len(prize)):
    if lot == prize[i]:
      x += prize[-1]
  return x
def big_prizes(lot,prizes):
  x = 0
  for i in range(len(prizes)):
    x += prize_check(lot,prizes[i])
  return x
def next_to_first(lot,prize):
  x = 0
  y = int(prize[0])
  if (int(lot)+1)%10**6 == y or (int(lot)-1)%10**6 == y:
    x += prize[-1]
  return x
def first_digits_check(lot,prize):
  x = 0
  if lot[0:3] == prize[0] or lot[0:3] == prize[1]:
    x += prize[2]
  return x
def last_digits_check(lot,prize):
  x = 0
  if len(prize) == 3:
    if lot[3:6] == prize[0] or lot[3:6] == prize[1]:
      x += prize[2]
  else:
    if lot[4:6] == prize[0]:
      x += prize[1]
  return x
def digit_prizes(lot,prizes):
  x = 0
  x += first_digits_check(lot,prizes[0])
  x += last_digits_check(lot,prizes[1])
  x += last_digits_check(lot,prizes[2])
  return x
def total_prize (lot,all_prizes):
  x = 0
  x += big_prizes(lot,all_prizes[0:5])
  x += next_to_first(lot,all_prizes[5])
  x += digit_prizes(lot,all_prizes[6:])
  return x

6632219221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_10.0
[0, 071, 071]
test_first_digits_check_20.0
[0, 0142, 0142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 696, 'const': 936, 'code+const': 1632}
def prize_check (lot,prize):
    money = 0
    money_t = 0
    for e in prize:
        if lot == e:
            money = prize[len(prize)-1]
            money_t += money
    return money_t
def big_prizes (lot,prizes):
    money = 0
    money += prize_check(lot,prizes[0])
    money += prize_check(lot,prizes[1])
    money += prize_check(lot,prizes[2])
    money += prize_check(lot,prizes[3])
    money += prize_check(lot,prizes[4])
    return money
def next_to_first (lot,prize):
    money = 0
    money_t = 0
    for e in prize:
        if abs(int(lot)-int(e)) == 1: #normal
            money = prize[len(prize)-1]
            money_t += money
        if (e == "999999") and (lot  == "999998" or lot == "000000"):#999999
            money = prize[len(prize)-1]
            money_t += money
        if (e == "000000") and (lot  == "999999" or lot == "000001"):#000000
            money = prize[len(prize)-1]
            money_t += money
    return money_t
def first_digits_check(lot,prize):
    money = 0
    money_t = 0
    for e in prize:
        if lot[1:4:1] == e: #first3
            money = prize[len(prize)-1]
            money_t += money
    return money_t
def last_digits_check(lot,prize):
    money = 0
    money_t = 0
    for e in prize:
        if lot[3:] == e: #last3
            money = prize[len(prize)-1]
            money_t += money
        elif lot[4:] == e: #last2
            money = prize[len(prize)-1]
            money_t += money
    return money_t
def digit_prizes(lot,prizes):
    money = 0
    money += first_digits_check(lot,prizes[0])
    money += last_digits_check(lot,prizes[1])
    money += last_digits_check(lot,prizes[2])
    return money
def total_prize(lot,all_prizes):
    money = 0
    money += big_prizes(lot,all_prizes[:5])
    money += next_to_first(lot,all_prizes[5])
    money += digit_prizes(lot,all_prizes[6:])
    return money

6330070321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'a1' is not defined")
[186005]
bytecount: {'code': 706, 'const': 940, 'code+const': 1646}
def prize_check (lot,prize):
    c=0
    for i in range(len(prize)-1):
        if lot==prize[i]:
            c+=(prize[-1])
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    c=0
    for k in range(len((prizes))):
 #k=0,1,2,3,4
        for i in range(len(prizes[k])):
            if lot == prizes[k][i]:
                c+=prizes[k][-1]
    global a3
    a3 = c
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    c=0
    if prize[0]=='999999'and (lot == '999998' or lot == '000000'):
            c+=prize[-1]
    else:
        if prize[0]=='000000'and (lot == '999999' or lot == '000001'):
            c+=prize[-1]
        else:
            if int(lot) == (int(prize[0])+1) or int(lot) == (int(prize[0])-1):
                c+=prize[-1]
            else:
                c=0
    global a2
    a2 = c
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    c=0
    for i in range(len((prize))-1):
        if lot[:3]==prize[i]:
            c+=prize[-1]
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    c=0
    for i in range(len((prize))-1):
        if lot[-(len((prize))):] == prize[i]:
            c+=prize[-1]
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
# lot = '555555'
# prizes = [['555', '666', 4000],['777', '888', 4000],['55', 2000]]
    c=0
    for i in range(len(prizes[0])-1):
        if lot[:3] == prizes[0][i]:
            c+=prizes[0][-1]
    back3 = prizes[1]
    back2 = prizes[2]
    for i in range(2):
        if back3[i]==lot[-3:]:
            c+=back3[-1]
    for i in range(1):
        if back2[i]==lot[-2:]:
            c+=back2[-1]
    global a1
    a1 = c
    return c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    return a1+a2+a3
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6330128121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 023, 023, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 544, 'const': 800, 'code+const': 1344}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        s=0
        for e in prize:
            c=0
            if lot==e:
                c=c+1
                s=s+(c*prize[-1])
        return s
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    s=0
    for i in prizes:
        for e in i:
            c=0
            if lot==e:
                c=c+1
                s=s+(c*i[-1])
    return s
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    s=0
    for e in prize:
        c=0
        if lot==str(int(e)+1)[0:6] or lot==str(int(e)-1)[0:6]:
            c=c+1
            s=s+(c*prize[-1])
    return s
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    s=0
    for e in prize:
        c=0
        if lot[0:3]==e:
            c=c+1
            s=s+(c*prize[-1])
    return s
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    s=0
    for e in prize:
        c=0
        if lot[-3:]==e or lot[-2:]==e:
            c=c+1
            s=s+(c*prize[-1])
    return s
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    return (last_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2]))
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    total=0
    total=total+ big_prizes(lot,all_prizes[0:5])
    total=total+ next_to_first(lot,all_prizes[5])
    total=total+ digit_prizes(lot,all_prizes[6:])
    return total

6530145021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 0, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 578, 'const': 906, 'code+const': 1484}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        amount = 0
        money = prize[-1]
        p = prize[:-1]
        for i in p :
            if (i == lot) :
                amount += money
        return amount
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        amount = 0
        for prize in prizes :
            amount += prize_check (lot,prize)
        return amount
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        a = '0'*(6-len(str(lot))) + (str(int(lot)-1))
        b = '0'*(6-len(str(lot))) + (str(int(lot)+1))
        if (lot == '000000') :
            a = '999999'
            b = '000001'
        if (lot == '999999') :
            a = '999998'
            b = '000000'
        amount = 0
        money = prize[-1]
        p = prize[:-1]
        for i in p :
            if (i == lot or  i == a or i == b) :
                amount += money
        return amount
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        amount = 0
        money = prize[-1]
        p = prize[:-1]
        for i in p :
            if (i[:3] == lot[:3]) :
                amount += money
        return amount
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        amount = 0
        money = prize[-1]
        p = prize[:-1]
        for i in p :
            if (i == lot[-3:] or i == lot[-2:]) :
                amount += money
        return amount
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6630051721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 562, 'const': 814, 'code+const': 1376}
def prize_check (lot,prize):
    t=0
    for i in prize:
        if i == lot:
            t+=prize[-1]
    return t
def big_prizes (lot,prizes):
    t=0
    for i in range(len(prizes)):
        t+=prize_check(lot,prizes[i])
    return t
def next_to_first (lot,prize):
    t=0
    if prize[0][5]=='0':
        if lot[5] == '9' or lot[5] == '1':
            t+=prize[-1]
    elif lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
        t+=prize[-1]
    return t
def first_digits_check(lot,prize):
    t=0
    for i in prize:
        if i == lot[:3]:
            t+=prize[-1]
    return t
def last_digits_check(lot,prize):
    t=0
    for i in prize:
        if i == lot[4:]:
            t+=prize[-1]
    return t
def digit_prizes (lot,prizes):
    t=0
    for i in range(len(prizes)):
        if i == 0:
            t+=first_digits_check(lot,prizes[i])
        if i == 1:
            for e in prizes[i]:
                if e == lot[3:]:
                    t+=prizes[i][-1]
        if i == 2:
            t+=last_digits_check(lot,prizes[i])
    return t
def total_prize (lot,all_prizes):
    t=big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
    return t

6630063221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 526, 'const': 636, 'code+const': 1162}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    monny=0
    for e in range(len(prize[0:-1])):
        if lot == prize[e]:
            monny+=prize[-1]
    return monny
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
     monny=0
     for e in prizes:
        m=prize_check(lot,e)
        monny+=m
     return monny
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    a=int(prize[0])
    min=(a-1)
    max=(a+1)
    if a==999999:
        max=000000
    if a==0000000:
        min=999999
    a=[min,max]
    monny=0
    for e in range(1):
        if int(lot) == a[e]:
              monny+=prize[-1]
    return monny
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    monny=0
    for e in range(len(prize[0:-1])):
        if lot[:3] == prize[e]:
              monny+=prize[-1]
    return monny
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    monny=0
    for e in range(len(prize[0:-1])):
        if lot[3:] == prize[e] or lot[4:] == prize[e]:
              monny+=prize[-1]
    return monny
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6630068421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 744, 'code+const': 1292}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for i in range(len(prize)-1):
            if lot == prize[i]:
                total += prize[-1]
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        totalprize = 0
        for i in range(5):
            totalprize += prize_check(lot,prizes[i])
        return totalprize
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        totalfromnext = 0
        if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1:
            totalfromnext += prize[1]
        return totalfromnext
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        totalfromfirst = 0
        for i in range(len(prize)-1):
            if lot[:3] in prize[i]:
                totalfromfirst += prize[-1]
            else:
                pass
        return totalfromfirst
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        totalfromlast = 0
        if len(prize) == 3:
            for j in range(2):
                if lot[-3::] == prize[j]:
                    totalfromlast += prize[-1]
        if len(prize) == 2:
            if lot[-2::] == prize[0]:
                totalfromlast += prize[-1]
        return totalfromlast
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        totaldigitprize = 0
        totaldigitprize += first_digits_check(lot,prizes[0])
        for i in range(2):
            totaldigitprize += last_digits_check(lot,prizes[i+1])
        return totaldigitprize
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        totalprize = 0
        totalprize += big_prizes (lot,all_prizes[0:5:])
        totalprize += digit_prizes(lot,all_prizes[6::])
        totalprize += next_to_first (lot,all_prizes[5])
        return totalprize

6630072921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 580, 'const': 832, 'code+const': 1412}
def prize_check (lot,prize):
    total = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            total += prize[-1]
    return total
def big_prizes (lot,prizes):
    total = prize_check (lot,prizes[0])
    total += prize_check (lot,prizes[1])
    total += prize_check (lot,prizes[2])
    total += prize_check (lot,prizes[3])
    total += prize_check (lot,prizes[4])
    return total
def next_to_first (lot,prize):
    total = 0
    if int(lot)+1 == int(prize[0]):
            total += prize[-1]
    return total
def first_digits_check(lot,prize):
    total = 0
    for i in range(len(prize)-1):
        if lot[0:3] == prize[i]:
            total += prize[-1]
    return total
def last_digits_check(lot,prize):
    total = 0
    if len(prize[0]) == 3:
        for i in range(len(prize)-1):
            if lot[-3:] == prize[i]:
                total += prize[-1]
    else:
        for i in range(len(prize)-1):
            if lot[-2:] == prize[i]:
                total += prize[-1]
    return total
def digit_prizes (lot,prizes):
    total = first_digits_check(lot,prizes[0])
    total += last_digits_check(lot,prizes[1])
    total += last_digits_check(lot,prizes[2])
    return total
def total_prize (lot,all_prizes):
    total = big_prizes (lot,all_prizes[:5])
    total += next_to_first (lot,all_prizes[5])
    total += digit_prizes (lot,all_prizes[6:])
    return total

6630073521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 402, 'const': 578, 'code+const': 980}
def prize_check(lot, prize):
    # lot = "555555"
    # prize = ['555555', '555555', '777777', '888888', 40000]
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    return prize.count(lot) * prize[-1]
def big_prizes(lot, prizes):
    # lot = "555555"
    # prizes = [
    #   ['555556', 6000000], # First price
    #   ['111111', '222222', 200000],  # Second price
    #   ['333333', '444444', '666666', 80000], # Third price
    #   ['555555', '555555', '777777', '888888', 40000], # Forth price
    #   ['000001', '000002', '000003', '000004', '000005', '000006', 20000], # Fifth price
    # ]
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    total = 0
    for prize in prizes:
        total += prize_check(lot, prize)
    return total
def next_to_first(lot, prize):
    # lot = "555555"
    # prize = ['555556', 100000] (555555, 555557)
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    # str(int('1' + '555556') +- 1)[1:]
    check_1 = str(int("1" + prize[0]) - 1)[1:]
    check_2 = str(int("1" + prize[0]) - 1)[1:]
    if lot in [check_1, check_2]:
        return prize[-1]
    return 0
def first_digits_check(lot, prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # lot = "555556"
    # prize = ['555', '666', 4000]
    n = prize.count(lot[0:3])
    return prize[-1] * n
def last_digits_check(lot, prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # prize = ['777', '888', 4000]
    # prize = ['55', 2000]
    # lot[-2:] = last 2 digits
    # lot[-3:] = last 3 digits
    n = prize.count(
        lot[-len(prize[0]):]
    )
    return n * prize[-1]
def digit_prizes(lot, prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    # prizes = [
    #   ['555', '666', 4000], # First 3 digits
    #   ['777', '888', 4000], # Last 3 digits
    #   ['55', 2000] # Last 2 digits
    # ]
    total = first_digits_check(lot, prizes[0])
    total += last_digits_check(lot, prizes[1])
    total += last_digits_check(lot, prizes[2])
    return total
def total_prize(lot, all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    total = big_prizes(lot, all_prizes[:5])
    total += next_to_first(lot, all_prizes[5])
    total += digit_prizes(lot, all_prizes[6:])
    return total

6630074121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0UnboundLocalError("local variable 'a' referenced before assignment")
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 678, 'const': 938, 'code+const': 1616}
def prize_check (lot,prizes):
    if lot in prizes:
        b = prizes.count(lot)
        a = prizes[-1]* b
    if lot not in prizes:
       a = 0
    return a
def big_prizes (lot,prizes):
    c = 0
    for i in range(len(prizes)):
         if lot in prizes[i]:
            b = prizes[i].count(lot)
            a = prizes[i][-1]* b
         if lot not in prizes[i]:
            a = 0
         c += a
    return c
def next_to_first (lot,prizes):
    if prizes[1] == '999999' and lot in ['999998','000000']:
        a = prizes[-1]
    elif prizes[1] == '000000' and lot in ['999999','000001']:
        a = prizes[-1]
    elif int(lot) == (int(prizes[0])+1) or int(lot) == (int(prizes[0])-1):
        a = prizes[-1]
    else:
        a=0
    return a
def first_digits_check(lot,prize):
    if lot[:3] in prize:
        b = prize.count(lot[:3])
        a = prize[-1]* b
    if lot[:3] not in prize:
       a = 0
    return a
def last_digits_check(lot,prize):
    if len(prize) == 3:
        if lot[-3:] in prize:
            b= prize.count(lot[-3:])
            a= prize[-1]*b
        else :
            a = 0
    elif len(prize) == 2:
       if lot[-2:] in prize:
           b= prize.count(lot[-2:])
           a= prize[-1]*b
       else :
            a = 0
    return a
def digit_prizes (lot,prizes):
     a = first_digits_check(lot,prizes[0])
     b = last_digits_check(lot,prizes[1])
     c = last_digits_check(lot,prizes[2])
     p = a+b+c
     return p
def total_prize (lot,all_prizes):
    a = big_prizes (lot,all_prizes[0:5])
    b = next_to_first (lot,all_prizes[5])
    c = digit_prizes (lot,all_prizes[-3:])
    p = a+b+c
    return p

6630221021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 884, 'const': 940, 'code+const': 1824}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prize :
            if i == lot :
                money += prize[-1]
        return (money)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prizes:
            for j in i :
                if j == lot :
                    money += i[-1]
            if i == 5:
                return
        return (money)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        for i in prize:
            if int(i) == 999999 : #กรณีรางวัลที่1 คือ 999999
                before = int(i)-1
                after = 000000
                if lot == before or lot == after:
                    money += prize[-1]
            elif int(i) == 000000 : #กรณีรางวัลที่1 คือ 000000
                before = 999999
                after = int(i)+1
                if lot == before or lot == after:
                    money += prize[-1]
            elif int(i)+1 == int(lot) or int(i)-1 == int(lot) : #กรณีอื่นๆ
                money += prize[-1]
        return (money)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prize :
            if i == lot[:3]:
                money += prize[-1]
        return (money)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        money = 0
        for i in prize :
            if i == lot[-3:] or i == lot[-2:] :
                money += prize[-1]
        return (money)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prizes :
            for j in i:
                if j == lot[:3] or j == lot[-3:] or j == lot[-2:]:
                   money += i[-1]
        return (money)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        money = 0
        for i in all_prizes: #กรณีรางวัลที่1-5
            for j in i :
                if j == lot :
                    money += i[-1]
            if i == 5:
                return
        for i in all_prizes: #กรณีรางวัลข้างเคียงรางวัลที่1
            for j in i :
                if int(j) == 999999 : #กรณีรางวัลที่1 คือ 999999
                    before = int(j)-1
                    after = 000000
                    if lot == before or lot == after:
                        money += i[-1]
                elif int(j) == 000000 : #กรณีรางวัลที่1 คือ 000000
                    before = 999999
                    after = int(j)+1
                    if lot == before or lot == after:
                        money += i[-1]
                elif i[-1] == 100000: #กรณีอื่นๆ
                    if int(j)+1 == int(lot) or int(j)-1 == int(lot) :
                        money += i[-1]
        for i in all_prizes : #รางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว
            for j in i:
                if j == lot[:3] or j == lot[-3:] or j == lot[-2:] :
                   money += i[-1]
        return (money)

6630308021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 884, 'const': 940, 'code+const': 1824}
def prize_check (lot,prize):
        cash = 0
        for i in prize:
            if i == lot:
                cash += prize[-1]
        return(cash)
def big_prizes (lot,prizes):
        cash = 0
        for i in prizes:
            for j in i:
                if j == lot:
                    cash += i[-1]
            if i == 5:
                return
        return(cash)
def next_to_first (lot,prize):
        cash = 0
        for i in prize:
            if int(i) == 999999:
                b = int(i)-1
                a = 000000
                if lot == b or lot == a:
                    cash += prize[-1]
            elif int(i) == 000000:
                b = 999999
                a = int(i)+1
                if lot == b or lot == a:
                    cash += prize[-1]
            elif int(i)+1 == int(lot) or int(i)-1 == int(lot):
                cash += prize[-1]
        return(cash)
def first_digits_check(lot,prize):
        cash = 0
        for i in prize:
            if i == lot[:3]:
                cash += prize[-1]
        return(cash)
def last_digits_check(lot,prize):
        cash = 0
        for i in prize:
            if i == lot[-3:] or i == lot[-2:]:
                cash += prize[-1]
        return(cash)
def digit_prizes (lot,prizes):
        cash = 0
        for i in prizes:
            for j in i:
                if j == lot[:3] or j == lot[-3:] or j == lot[-2:]:
                   cash += i[-1]
        return(cash)
def total_prize (lot,all_prizes):
        cash = 0
        for i in all_prizes:
            for j in i:
                if j == lot:
                    cash += i[-1]
            if i == 5:
                return
        for i in all_prizes:
            for j in i:
                if int(j) == 999999:
                    b = int(j)-1
                    a = 000000
                    if lot == b or lot == a:
                        cash += i[-1]
                elif int(j) == 000000:
                    b = 999999
                    a = int(j)+1
                    if lot == b or lot == a:
                        cash += i[-1]
                elif i[-1] == 100000:
                    if int(j)+1 == int(lot) or int(j)-1 == int(lot):
                        cash += i[-1]
        for i in all_prizes:
            for j in i:
                if j == lot[:3] or j == lot[-3:] or j == lot[-2:]:
                   cash += i[-1]
        return (cash)

6631001521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1152, 'const': 800, 'code+const': 1952}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        for i in range(len(prize) -1):
                if(lot == prize[i]):
                        price += prize[len(prize)-1]
        return price
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        for i in range(len(prizes)):
                prize = prizes[i]
                for j in range(len(prize) -1):
                    if(lot == prize[j]):
                            price += prize[len(prize)-1]
        return price
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        price = 0
        nextup = int(prize[0]) + 1
        nextdown = int(prize[0]) - 1
        nextup = str(nextup)
        nextdown = str(nextdown)
        if(lot == nextup or lot == nextdown):
                price = prize[1]
        return price
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
         price = 0
         checkFirstThree = lot[0:3]
         for i in range(len(prize) -1):
                if(checkFirstThree == prize[i]):
                        price = prize[len(prize) -1]
         return price
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        price = 0
        checkLastThree = lot[3:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastThree == prize[i]):
                        price += prize[len(prize) -1]
        #check last two
        checkLastTwo = lot[4:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastTwo == prize[i]):
                        price += prize[len(prize) -1]
        return price
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        price = 0
        prize = prizes[0]
        checkFirstThree = lot[0:3]
        for i in range(len(prize) -1):
                if(checkFirstThree == prize[i]):
                        price += prize[len(prize) -1]
        #check last three
        prize = prizes[1]
        checkLastThree = lot[3:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastThree == prize[i]):
                        price += prize[len(prize) -1]
        #check last two
        prize = prizes[2]
        checkLastTwo = lot[4:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastTwo == prize[i]):
                        price += prize[len(prize) -1]
        return price
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        price = 0
        for i in range(5):
                check = all_prizes[i]
                for j in range(len(check) - 1):
                        if(lot == check[j]):
                                price += check[len(check) -1]
        #check ใกล้เคียง1
        nextto = all_prizes[5]
        next = int(nextto[0])
        nextup = next + 1
        nextdown = next - 1
        nextup = str(nextup)
        nextdown = str(nextdown)
        if(lot == nextup or lot == nextdown):
                price += nextto[1]
        #check first 3 last 3 last 2
        prizes = all_prizes[6:]
        prize = prizes[0]
        checkFirstThree = lot[0:3]
        for i in range(len(prize) -1):
                if(checkFirstThree == prize[i]):
                        price += prize[len(prize) -1]
        #check last three
        prize = prizes[1]
        checkLastThree = lot[3:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastThree == prize[i]):
                        price += prize[len(prize) -1]
        #check last two
        prize = prizes[2]
        checkLastTwo = lot[4:len(lot)]
        for i in range(len(prize) -1):
                if(checkLastTwo == prize[i]):
                        price += prize[len(prize) -1]
        return price

6631003821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 462, 'const': 552, 'code+const': 1014}
def prize_check (lot,prize):
        reward = 0
        for e in prize:
            if type(e)==str:
                if(e) == lot:
                    reward += prize[-1]
        return reward
def big_prizes (lot,prizes):
        big_reward=0
        for p in prizes:
            big_reward += prize_check(lot,p)
        return big_reward
def next_to_first (lot,prize):
        if abs(int(lot)-int(prize[0])) == 1:
               return prize[1]
        else:
               return 0
def first_digits_check(lot,prize):
        f3reward = 0
        for f in prize:
            if type (f) == str:
                if f[:3] == lot[:3]:
                    f3reward += prize[-1]
        return f3reward
def last_digits_check(lot,prize):
        l2reward = 0
        for l in prize:
            if type (l) == str:
                if l[-2:] == lot[-2:]:
                    l2reward += prize[-1]
        return l2reward
def digit_prizes (lot,prizes):
        dr = 0
        for rr in prizes:
            if len(rr[0])==2:
                dr += last_digits_check(lot,rr)
            elif len(rr[0])==3:
                dr += first_digits_check(lot,rr)
        return dr
def total_prize (lot,all_prizes):
        return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6631005021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0UnboundLocalError("local variable 'prize_money' referenced before assignment")
[186005]
bytecount: {'code': 612, 'const': 908, 'code+const': 1520}
def prize_check (lot,prize):
    prize_money = 0
    for x in prize  :
        if type(x) == type('string') :
            if lot == x :
                prize_money +=  prize[-1]
    return (prize_money)
def big_prizes (lot,prizes):
    prize_money = 0
    for x in prizes :
        prize_money  += prize_check(lot,x)
    return (prize_money)
def next_to_first (lot,prize) :
    prize_money = 0
    for x in prize :
        if type(x) == type('string'):
            if int(lot)-int(x) == 1 or int(x)-int(lot)==1   :
                prize_money += prize[-1]
    return (prize_money)
def first_digits_check (lot,prize):
    prize_money = 0
    for x in prize  :
        if type(x)==type('string'):
            if lot[ :3] == x[ :3] :
                prize_money += prize[-1]
    return (prize_money)
def last_digits_check (lot,prize) :
    prize_money = 0
    for x in prize  :
        if type(x)==type('string'):
            if lot[len(lot)-2:] ==x[len(x)-2:] or lot[len(lot)-3:]==x[len(x)-3:] :
                prize_money += prize[-1]
    return (prize_money)
def digit_prizes (lot,prizes) :
    prize_money = 0
    prize_money += first_digits_check(lot,prizes[0])
    prize_money += last_digits_check(lot,prizes[1])
    prize_money += last_digits_check(lot,prizes[2])
    return (prize_money)
def total_prize (lot,all_prizes) :
    prize_monney = 0
    prize_money += big_prizes(lot,all_prizes[:5])
    prize_money += next_to_first(lot,all_prizes[5])
    prize_money += first_digits_check(lot,all_prizes[6])
    prize_money += last_digits_check(lot,all_prizes[7])
    prize_money += last_digits_check(lot,all_prizes[8])
    return (prize_money)

6631010121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 0987, 0987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 422, 'const': 726, 'code+const': 1148}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        return prize.count(lot)*prize[-1]
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for prize in prizes:
            total += prize.count(lot)*prize[-1]
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if (lot == "999999" and prize == "000000") or (lot =="000000" and prize == "999999"):
            return prize[-1]
        # print("debug")
        # print(lot[:5])
        # print(prize[0][:5])
        if lot[:5] == prize[0][:5]:
            last_lot = int(lot[5])
            last_prize = int(prize[0][5])
            if abs(last_lot - last_prize) == 1:
                return prize[-1]
        return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        return prize.count(lot[:3])*prize[-1]
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        digit = len(prize[0])
        return prize.count(lot[len(lot) - digit:])*prize[-1]
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, [all_prizes[6], all_prizes[7], all_prizes[8]])

6631108021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[0, 0987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 516, 'const': 692, 'code+const': 1208}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        t = 0
        for i in range(len(prize)-1) :
          if lot == prize[i] :
            t += prize[-1]
        return(t)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        t = 0
        for e in prizes :
          for i in range(len(e)-1) :
            if lot == e[i] :
              t += e[-1]
        return(t)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        t = 0
        for i in range(len(prize)-1) :
          if int(lot) == int(prize[i])+1 or int(prize[i])-1 :
            t += prize[-1]
        return(t)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        t = 0
        for i in range(len(prize)-1) :
            if lot[:3] == prize[i] :
              t += prize[-1]
        return(t)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        t = 0
        for i in range(len(prize)-1) :
          if lot[-len(prize[0]):] == prize[i] :
            t += prize[-1]
        return(t)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        k = first_digits_check(lot,prizes[0])
        t1 = last_digits_check(lot,prizes[1])
        t2 = last_digits_check(lot,prizes[2])
        return(k+t1+t2)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        t = big_prizes(lot,all_prizes[:5]) +  next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
        return(t)

6631115421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 758, 'const': 772, 'code+const': 1530}
def prize_check (lot,prize):
    bank= 0
    for i in range(len(prize)) :
        if lot == prize[i] :
            bank+=prize[-1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    bank=0
    for i in range(len(prizes)):
        for j in range(len(prizes[i])) :
            if lot == prizes[i][j] :
                bank+=prizes[i][-1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    bank=0
    if int(lot)+1 == int(prize[0]) or int(lot)-1 == int(prize[0]):
        bank+=prize[1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    bank = 0
    for i in range(len(prize)-1):
         if lot[:3]==prize[i] :
             bank += prize[-1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    bank=0
    if len(prize[0])==3:
        if lot[3:]==prize[0] :
            bank+=prize[-1]
    elif len(prize[0])==3:
        if lot[3:]==prize[1] :
            bank+=prize[-1]
    elif len(prize[0])==2 :
        if lot[4:]==prize[0] :
            bank+=prize[-1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    bank = 0
    for i in range(len(prizes)):
        for j in range(len((prizes)[i])-1):
            if len((prizes)[i][j]) == 3:
                if i == 1 :
                    if prizes[i][j] in lot[3:] :
                        bank += prizes[i][-1]
                elif i == 0 :
                    if prizes[i][j] in lot[:3]:
                        bank += prizes[i][-1]
            else :
                if prizes[i][j] in lot[4:]:
                    bank += prizes[i][-1]
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    bank = 0
    bank = big_prizes (lot,all_prizes[:5])+next_to_first (lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
    return bank
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631134321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 576, 'const': 744, 'code+const': 1320}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  x = 0
  for N in prize[0:-1:1]:
    if lot == N:
      x += int(prize[-1])
  return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  x = 0
  for prize in prizes:
    x += prize_check (lot,prize)
  return x
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  x = 0
  next_to = []
  first,p = prize
  if first == first:
    next_to += [str(int(first)-1) or str(int(first)+1)]
  for N in next_to:
    if lot == N:
      x += p
  return x
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  x = 0
  for N in prize[0:-1:1]:
    if lot[0:3:1] == N:
      x += prize[-1]
  return x
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  x = 0
  for N in prize[0:-1:1]:
    if len(N) == 3:
      if lot[3:6:1] == N:
        x += prize[-1]
    else :
      if len(N) == 2:
        if lot[4:6:1] == N:
          x += prize[-1]
      else:
        pass
  return x
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  x = 0
  for i in range(len(prizes)):
    if i == 0:
      x += first_digits_check(lot,prizes[i])
    else:
      x += last_digits_check(lot,prizes[i])
  return x
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  x = 0
  x += big_prizes(lot,all_prizes[0:5:1])
  x += next_to_first(lot,all_prizes[5])
  x += digit_prizes (lot,all_prizes[6:9:1])
  return x

6631203021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 7142, 7142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_20.0
[0, 82111]
test_total_prize1.0
[186005]
bytecount: {'code': 644, 'const': 904, 'code+const': 1548}
import re
def prize_check (lot,prize):
    m = 0
    for a in range(len(prize)):
        if lot == prize[a]:
          m += prize[-1]
    return  m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    m = 0
    for b in range(len(prizes)):
       m += prize_check(lot,prizes[b])
    return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
   m = 0
   if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0]) - 1 :
         m += prize[-1]
   elif  prize[0] == '999999':
          if lot == '999998' or lot == '000000':
            m += prize [-1]
   elif prize[0] == '000000':
          if lot == '999999' or lot == '000001':
            m += prize[-1]
   return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    m = 0
    for a in range(len(prize)-1):
        if lot[:3] == prize[a]:
         m += prize[-1]
    return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        m = 0
        if len(prize[0]) == 3 :
          if lot[-3:] == prize[0] or lot[-3:] == prize[1]:
            m += prize[-1]
        else :
          if lot[-2:] == prize[0] :
            m += prize[-1]
        return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    m = 0
    for a in range(len(prizes)):
      if a == 0 :
       m += first_digits_check(lot,prizes[a])
      else :
       m += last_digits_check(lot,prizes[a])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    return m
def total_prize (lot,all_prizes):
   m = 0
   m += big_prizes(lot,all_prizes[0:5]) + next_to_first(lot,all_prizes[5])+digit_prizes(lot,all_prizes[6:])
   return m
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631307621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 464, 'const': 608, 'code+const': 1072}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for c in prize[:-1]:
          if lot == c:
            sum += prize[-1]
        return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for c in prizes:
          for d in c[:-1]:
            if lot == d:
              sum += c[-1]
        return sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        sum = 0
        for c in prize[:-1]:
          if int(lot) == (int(c)-1)%1000000 or lot == (int(c)+1)%1000000:
            sum += prize[-1]
        return sum
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for c in prize[:-1]:
          if lot[:3] == c:
            sum += prize[-1]
        return sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        sum = 0
        for c in prize[:-1]:
          if lot[-len(c):] == c:
            sum += prize[-1]
        return sum
def digit_prizes (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return last_digits_check(lot,prize[1])+last_digits_check(lot,prize[2])+first_digits_check(lot,prize[0])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes[:5])+next_to_first(lot, all_prizes[5])+digit_prizes(lot, all_prizes[6:])

6631469621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0NameError("name 'all_prize' is not defined")
[186005]
bytecount: {'code': 512, 'const': 660, 'code+const': 1172}
def prize_check (lot,prize):
  allmoney = 0
  for i in prize[:-1]:
    if lot == i:
      allmoney += prize[-1]
  return allmoney
def big_prizes (lot,prizes):
  allmoney = 0
  for i in prizes:
    allmoney += prize_check(lot,i)
  return allmoney
def next_to_first (lot,prize):
  if lot == str(int(prize[0])-1) or lot == str(int(prize[0])+1):
    return prize[1]
  return 0
def first_digits_check(lot,prize):
  allmoney = 0
  for i in prize[:-1]:
    if lot[0:3] == i:
      allmoney += prize[-1]
  return allmoney
def last_digits_check(lot,prize):
  if len(prize[0]) == 3:
    allmoney = 0
    for i in prize[:-1]:
      if lot[3:] == i:
        allmoney += prize[-1]
    return allmoney
  elif len(prize[0]) == 2:
    allmoney = 0
    if prize[0] == lot[4:]:
      return prize[1]
    else:
      return 0
def digit_prizes (lot,prizes):
  allmoney = 0
  allmoney += first_digits_check(lot,prizes[0])+ last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
  return allmoney
def total_prize (lot,all_prizes):
  allmoney = 0
  allmoney += big_prizes(lot,all_prizes[:5])+next_to_first (lot,all_prize[5])+digit_prizes (lot,all_prizes[6:])
  return allmoney

6631502621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_10.0
[0, 23, 23, 029, 029, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 648, 'const': 664, 'code+const': 1312}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  su = 0
  for i in prize:
      if lot == i:
          su += prize[-1]
      else:
          su += 0
  return su
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  su=0
  for i in prizes:
      for k in i:
          if lot == k:
              su += i[-1]
  return su
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  su=0
  ip=int(prize[0])
  ip1 = str(ip+1)
  ip2 = str(ip-1)
  if lot in ip1:
      su += prize[-1]
  elif lot in ip2:
      su += prize[-1]
  return su
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  su=0
  rl= lot[0:3]
  for i in prize:
      if rl == i:
          su+=prize[-1]
  return su
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  su=0
  rl= lot[3:]
  for i in prize:
      if rl == i:
          su+=prize[-1]
  rl1 = lot[4:]
  for k in prize:
      if rl1 == k:
          su+=prize[-1]
  return su
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  su=0
  for b in prizes:
      rl= lot[0:3]
      for i in b:
          if rl == i:
              su+=b[-1]
      rl2= lot[3:]
      for s in b:
          if rl2 == i:
              su+=b[-1]
      rl1 = lot[4:]
      for k in b:
          if rl1 == k:
              su+=b[-1]
  return su
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  a= prize_check (lot,all_prizes)
  b= big_prizes (lot,all_prizes[:5])
  c= next_to_first (lot,all_prizes[5])
  d= first_digits_check (lot,all_prizes)
  e= last_digits_check (lot,all_prizes)
  f= digit_prizes (lot,all_prizes[6:])
  return a+b+c+d+e+f

6631539921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[18600035]
bytecount: {'code': 598, 'const': 824, 'code+const': 1422}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  money = 0
  for n in prize[0:-1]:
    if lot == n:
      money += int(prize[-1])
  return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  money = 0
  for prize in prizes:
    money += prize_check(lot,prize)
  return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  money = 0
  next = []
  first= prize[0]
  m = prize[1]
  if first == '000000':
    next += ['999999','000001']
  elif first == '999999':
    next += ['999998','000000']
  else:
    next += [str(int(first)-1), str(int(first)+1)]
  for i in next:
    if lot == i:
      money += m
  return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  money = 0
  for i in prize[:-1]:
    if lot[0:3] == i:
      money += prize[-1]
  return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  money = 0
  for i in prize[:-1]:
    if len(i) == 3:
      if lot[-3:] == i:
        money += prize[-1]
    elif len(i) == 2:
      if lot[-2:] == i:
        money += prize[-1]
  return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  money = 0
  for i in range(len(prizes)):
    if i == 0:
      money += first_digits_check(lot,prizes[i])
    else:
      money += last_digits_check(lot,prizes[i])
  return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  money = 0
  money += big_prizes(lot,all_prizes[0:5])
  money += next_to_first(lot,all_prizes[5])
  money += digit_prizes (lot,all_prizes[6:0])
  return money

6631801221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[0, 987, 0987]
test_next_to_first_20.0
[0, 987, 0987, 987, 0987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 748, 'const': 936, 'code+const': 1684}
def  prize_check (lot,prize):
    m = 0
    for i in range(len(prize) -1):
        if lot == prize[i]:
            m += prize[-1]
        else:
            m += 0
    return m
def big_prizes (lot,prizes):
    m = 0
    for i in range(len(prizes[:5])):
        for e in prizes[i]:
            if lot == e:
                m += prizes[i][-1]
            else:
                m += 0
    return m
def next_to_first (lot,prize):
    m = 0
    ans = []
    if lot != "000000" or lot != "999999":
        for i in range(len(prize) -1):
            if lot == int(prize[i]) +1 or int(lot) == int(prize[i])-1:
                m += prize[-1]
            else:
                m += 0
    elif lot == "000000" :
        ans += ["999999","000001"]
    elif lot == "999999":
        ans += ["999998","000000"]
    else:
        ans += [str(int(prize)-1),str(int(prize)+1)]
    for e in ans:
        if lot == e:
            m += prize
    return m
def first_digits_check(lot,prize):
    m = 0
    for i in prize[:-1]:
        if lot[:3] == i:
            m += prize[-1]
    return m
def last_digits_check(lot,prize):
    m=0
    for i in prize[:-1]:
        if len(i) == 3:
            if lot[-3:] == i:
                m += prize[-1]
        elif len(i) == 2:
            if lot[-2:] == i:
                m += prize[-1]
    return m
def digit_prizes (lot,prizes):
    m = 0
    for i in range(len(prizes)):
        if i == 0:
            m += first_digits_check(lot,prizes[i])
        else:
            m += last_digits_check(lot,prizes[i])
    return m
def total_prize (lot,all_prizes):
    m = 0
    m += big_prizes(lot,all_prizes[:5])
    m += next_to_first(lot,all_prizes[5])
    m += digit_prizes (lot,all_prizes[6:])
    return m

6631805821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_20.0
[0, 0, 200071]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1700, 'const': 1436, 'code+const': 3136}
def prize_check (lot,prize):
  fr_prize = prize
  i = 0
  m = 0
  for i in range(0,len(fr_prize)) :
    if lot == fr_prize[i] :
      m += fr_prize[-1]
    else :
      m += 0
    i += 1
  return(m)
def big_prizes (lot,prizes):
  fr_prize = prizes
  all_m = 0
  r = 0
  for r in range(0,len(fr_prize)) :
    fprize = fr_prize[r]
    r += 1
    i = 0
    m = 0
    for i in range(0,len(fprize)) :
      if lot == fprize[i] :
        m += fprize[-1]
      else :
        m += 0
      i += 1
    all_m += m
  return(all_m)
def next_to_first (lot,prize):
  nt_prize = prize
  st = int(prize[0])
  if prize[0] >= "000001" and prize[0] <= "999998" :
    if lot == str(st+1) or lot == str(st-1) :
      return(nt_prize[1])
    else :
      return(0)
  if prize[0] == "000000" :
    if lot == "000001" or lot == "999999" :
      return(nt_prize[1])
    else :
      return(0)
  if prize[0] == "999999" :
    if lot == "999998" or lot == "000000" :
      return(nt_prize[1])
    else :
      return(0)
def first_digits_check(lot,prize):
  fd_prize = prize
  m = 0
  i = 0
  for i in range(0,len(fd_prize)) :
    if lot[0:3] == fd_prize[i] :
      m += fd_prize[-1]
    else :
      m += 0
    i += 1
  return(m)
def last_digits_check(lot,prize):
  ld_prize = prize
  m = 0
  if len(ld_prize[0]) == 3 :
    i = 0
    for i in range(0,len(ld_prize)) :
      if lot[3:] == ld_prize[i] :
        m += ld_prize[-1]
      else :
        m += 0
      i += 1
  else :
    i = 0
    for i in range(0,len(ld_prize)) :
      if lot[4:] == ld_prize[i] :
        m += 2000
      else :
        m += 0
      i += 1
  return(m)
def digit_prizes (lot,prizes):
  dg_prize = prizes
  r = 0
  for r in range(0,len(dg_prize)) :
    dgprize = dg_prize[r]
    if r == 0 :
      m1 = 0
      i = 0
      for i in range(0,len(dgprize)) :
        if lot[0:3] == dgprize[i] :
          m1 += dgprize[-1]
        else :
          m1 += 0
        i += 1
    if r == 1 :
      m2 = 0
      i = 0
      for i in range(0,len(dgprize)) :
        if lot[3:] == dgprize[i] :
          m2 += dgprize[-1]
        else :
          m2 += 0
        i += 1
    if r == 2 :
      m3 = 0
      i = 0
      for i in range(0,len(dgprize)) :
        if lot[4:] == dgprize[i] :
          m3 += dgprize[-1]
        else :
          m3 += 0
        i += 1
    r += 1
  all_m = (m1 + m2 + m3)
  return(all_m)
def total_prize (lot,all_prizes):
  fr_prize = all_prizes[0:5]
  all_m1 = 0
  r1 = 0
  for r1 in range(0,len(fr_prize)) :
    fprize = fr_prize[r1]
    r1 += 1
    i = 0
    m1 = 0
    for i in range(0,len(fprize)) :
      if lot == fprize[i] :
        m1 += fprize[-1]
      else :
        m1 += 0
      i += 1
    all_m1 += m1
  nt_prize = all_prizes[5]
  all_m2 = 0
  st = int(nt_prize[0])
  if nt_prize[0] >= "000001" and nt_prize[0] <= "999998" :
    if lot == str(st+1) or lot == str(st-1) :
      all_m2 += (nt_prize[1]) ##*
    else :
      all_m2 += 0 ##*
  if nt_prize[0] == "000000" :
    if lot == "000001" or lot == "999999" :
      all_m2 += (nt_prize[1]) ##*
    else :
      all_m2 += 0 ##*
  if nt_prize[0] == "999999" :
    if lot == "999998" or lot == "000000" :
      all_m2 += (nt_prize[1])
    else :
      all_m2 += 0
  dg_prize = all_prizes[6:]
  r3 = 0
  for r3 in range(0,len(dg_prize)) :
    dgprize = dg_prize[r3]
    if r3 == 0 :
      m31 = 0
      j = 0
      for j in range(0,len(dgprize)) :
        if lot[0:3] == dgprize[j] :
          m31 += dgprize[-1]
        else :
          m31 += 0
        j += 1
    if r3 == 1 :
      m32 = 0
      j = 0
      for j in range(0,len(dgprize)) :
        if lot[3:] == dgprize[j] :
          m32 += dgprize[-1]
        else :
          m32 += 0
        j += 1
    if r3 == 2 :
      m33 = 0
      j = 0
      for j in range(0,len(dgprize)) :
        if lot[4:] == dgprize[j] :
          m33 += dgprize[-1]
        else :
          m33 += 0
        j += 1
    r3 += 1
  all_m3 = (m31 + m32 + m33)
  total_m = (all_m1 + all_m2 + all_m3)
  return(total_m)

6632084821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 744, 'code+const': 1292}
def prize_check(lot, prize):
    winnings = 0
    for p in prize:
        if lot == p:
            winnings += prize[-1]
    return winnings
def big_prizes(lot, prizes):
    winnings = 0
    for prize in prizes[:5]:
        winnings += prize_check(lot, prize)
    return winnings
def next_to_first(lot, prize):
    adjacent_prizes = [str(int(prize[0]) - 1), str(int(prize[0]) + 1)]
    winnings = 0
    for p in adjacent_prizes:
        if lot == p:
            winnings += prize[-1]
    return winnings
def first_digits_check(lot, prize):
    winnings = 0
    for p in prize:
        if lot[:3] == p:
            winnings += prize[-1]
    return winnings
def last_digits_check(lot, prize):
    winnings = 0
    for p in prize:
        if lot[-2:] == p:
            winnings += prize[-1]
    return winnings
def digit_prizes(lot, prizes):
    winnings = 0
    for p in prizes[0]:
        if lot[:3] == p:
            winnings += int(prizes[0][-1])
    for p in prizes[1]:
        if lot[-3:] == p:
            winnings += int(prizes[1][-1])
    for p in prizes[2]:
        if lot[-2:] == p:
            winnings += int(prizes[2][-1])
    return winnings
def total_prize(lot, all_prizes):
    winnings = 0
    winnings += big_prizes(lot, all_prizes[:5])
    winnings += next_to_first(lot, all_prizes[5])
    winnings += digit_prizes(lot, all_prizes[6:])
    return winnings

6632111021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_10.0
[9870, 987, 987]
test_next_to_first_20.0
[0, 987, 0, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 412, 'const': 664, 'code+const': 1076}
def prize_check(lot, prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prize[:-1]:
          if i == lot:
            money += prize[-1]
        return money
def big_prizes(lot, prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for prize in prizes:
          money += prize_check(lot, prize)
        return money
def next_to_first(lot, prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้.
        if prize[0] == '999999':
          new_prize = ['999998', '000000'] + prize
        elif prize[0] == '000000':
          new_prize = ['999999', '000001'] + prize
        else:
          new_prize = [str(int(prize[0])-1), str(int(prize[0])+1)] + prize
        return prize_check(lot, new_prize)
def first_digits_check(lot, prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        return prize_check(lot[:3], prize)
def last_digits_check(lot, prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        return prize_check(lot[-len(prize[0]):], prize)
def digit_prizes (lot, prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot, all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6331501721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 522, 'const': 660, 'code+const': 1182}
def prize_check (lot,prize):
        s = 0
        for e in prize:
            if e == lot:
                s += int(prize[-1])
        return s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
        s = 0
        for e in prizes:
            for i in e:
                if i == lot:
                    s += int(e[-1])
        return s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        s = 0
        for e in prize:
            if int(e)+1 == int(lot) or int(e)-1 == int(lot) :
                if int(e)+1 == int(lot) :
                    s += int(prize[-1])
                if int(e)-1 == int(lot):
                    s += int(prize[-1])
        return s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
        s = 0
        for e in prize:
            if e == lot[:3:]:
                s += int(prize[-1])
        return s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        s = 0
        for e in prize:
            if e == lot[3::]:
                s += int(prize[-1])
            if e == lot[4::]:
                s += int(prize[-1])
        return s
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
     return first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        return big_prizes (lot,all_prizes[0:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6430314621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 470, 'const': 520, 'code+const': 990}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for num in prize[:-1]:
          if(lot == num):
            total+=prize[-1]
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for prize in prizes:
          total += prize_check(lot,prize)
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        before = str(int(prize[0])-1)
        after = str(int(prize[0])+1)
        return prize_check(lot,[before,after,prize[1]])
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for num in prize[:-1]:
          if(lot[:len(num)] == num):
            total+=prize[-1]
        return total
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        total = 0
        for num in prize[:-1]:
          if(lot[-len(num):] == num):
            total+=prize[-1]
        return total
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        total += first_digits_check(lot,prizes[0])
        total += last_digits_check(lot,prizes[1])
        total += last_digits_check(lot,prizes[2])
        return total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        totalPrize = 0
        totalPrize += big_prizes(lot,all_prizes[:5])
        totalPrize += next_to_first(lot,all_prizes[5])
        totalPrize += digit_prizes(lot,all_prizes[6:])
        return totalPrize

6530334221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 458, 'const': 776, 'code+const': 1234}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total=0
        for i in range(len(prize)-1):
          if lot==prize[i]:
            total += prize[-1]
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total=0
        for i in prizes:
          total += prize_check(lot,i)
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        total=0
        if prize[0]=='000000':
          near1='999999'
          near2='000001'
        elif prize[0]=='999999':
          near1='999998'
          near2='000000'
        else:
          near1=str(int(prize[0])-1)
          near2=str(int(prize[0])+1)
        if lot==near1 or lot==near2:
          total+=prize[-1]
        return total
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        total = prize_check(lot[:3],prize)
        return total
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        total1=prize_check(lot[-3:],prize)
        total2=prize_check(lot[-2:],prize)
        return total1+total2
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        total=last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])+first_digits_check(lot,prizes[0])
        return total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        total=big_prizes(lot,all_prizes[0:5])+next_to_first (lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
        return total

6530377221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 618, 'const': 858, 'code+const': 1476}
def prize_check(lot,prize):
  pc = 0
  for e in prize[:-1]:
    if lot == e: pc += prize[-1]
  return pc
def big_prizes(lot,prizes):
  bp = 0
  for i in range(len(prizes)):
    pc = prize_check(lot,prizes[i])
    bp += pc
  return bp
def next_to_first(lot,prize):
  nf = 0
  if prize[0] == '000000':
    if lot in ['000001','999999']: nf += prize[1]
  elif prize[0] == '999999':
    if lot in ['000000','999998']: nf += prize[1]
  else:
    if lot in [str(int(prize[0])-1),str(int(prize[0])+1)]: nf += prize[1]
  return nf
def first_digits_check(lot,prize):
  fd = 0
  for e in prize[:-1]:
    if lot[:3] == e: fd += prize[-1]
  return fd
def last_digits_check(lot,prize):
  ld = 0
  if len(prize[0]) == 3:
    for e in prize[:-1]:
      if lot[-3:] == e: ld += prize[-1]
  if len(prize[0]) == 2:
    for e in prize[:-1]:
      if lot[-2:] == e: ld += prize[-1]
  return ld
def digit_prizes (lot,prizes):
  fd = first_digits_check(lot,prizes[0])
  ld3 = last_digits_check(lot,prizes[1])
  ld2 = last_digits_check(lot,prizes[2])
  dp = fd+ld3+ld2
  return dp
def total_prize (lot,all_prizes):
  bp = big_prizes(lot,all_prizes[:5])
  nf = next_to_first(lot,all_prizes[5])
  dp = digit_prizes (lot,all_prizes[6:])
  tp = bp+nf+dp
  return tp

6530394921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 532, 'const': 598, 'code+const': 1130}
def prize_check (lot,prize):
    reward = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
            reward += prize[-1]
    return reward
def big_prizes (lot,prizes):
    reward = 0
    for i in prizes :
        reward += prize_check(lot,i)
    return reward
def next_to_first (lot,prize):
    reward = 0
    number = prize[0]
    number = "1"+number
    upper = int(number) + 1
    lower = int(number) - 1
    upper = str(upper)
    lower = str(lower)
    upper = upper[1:len(upper)]
    lower = lower[1:len(lower)]
    nextToFirst = []
    nextToFirst.append(upper)
    nextToFirst.append(lower)
    nextToFirst.append(prize[-1])
    reward = prize_check(lot,nextToFirst)
    return reward
def first_digits_check(lot,prize):
    firstDigit  = lot[0:3]
    reward = 0
    reward = prize_check(firstDigit,prize)
    return reward
def last_digits_check(lot,prize):
    reward = 0
    lastDigit = lot[len(lot)-len(prize[0]):len(lot)]
    reward = prize_check(lastDigit,prize)
    return reward
def digit_prizes (lot,prizes):
    reward = 0
    reward += first_digits_check(lot,prizes[0])
    reward += last_digits_check(lot,prizes[1])
    reward += last_digits_check(lot,prizes[2])
    return reward
def total_prize (lot,all_prizes):
    reward = 0
    reward += big_prizes(lot,all_prizes[:5])
    reward += next_to_first(lot,all_prizes[5])
    reward += digit_prizes (lot,all_prizes[6:])
    return reward

6530403921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 458, 'const': 724, 'code+const': 1182}
def prize_check (lot,prize):
        x = 0
        for i in range(len(prize)):
            if lot == prize[i]:
              x += prize[-1]
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
        x = 0
        for i in prizes:
            x += prize_check(lot,i)
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        x = 0
        if prize[0] == '000000':
          n1 = '999999'
          n2 = '000001'
        elif prize[0] == '999999':
          n1 = '999998'
          n2 = '000000'
        else:
          n1 = str(int(prize[0])-1)
          n2 = str(int(prize[0])+1)
        if lot == n1 or lot == n2:
          x += prize[-1]
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
        x = prize_check(lot[:3],prize)
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        x1 = prize_check(lot[-3:],prize)
        x2 = prize_check(lot[-2:],prize)
        y = x1 + x2
        return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
        x = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        x = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
        return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6530433721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 508, 'const': 604, 'code+const': 1112}
def prize_check (lot,prize):
    a=0
    for i in range(len(prize)):
        if lot == prize[i]:
            a += prize[-1]
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    a=0
    for i in range(len(prizes)):
        a += prize_check(lot,prizes[i])
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1:
        return prize[-1]
    else: return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    a=0
    for i in range(len(prize)):
        if lot[0:3] == prize[i]:
            a += prize[-1]
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    a=0
    for i in range(len(prize)):
        if lot[3:] == prize[i] or lot[4:] == prize[i]:
            a += prize[-1]
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    a=0
    a += first_digits_check(lot,prizes[0])
    for i in range(len(prizes)-1):
        a += last_digits_check(lot,prizes[i+1])
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    a=0
    a += big_prizes (lot,all_prizes[:5])
    a += next_to_first (lot,all_prizes[5])
    a += digit_prizes (lot,all_prizes[6:])
    return a
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6531009521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 504, 'const': 748, 'code+const': 1252}
def prize_check (lot,prize):
  money=0
  for i in range(len(prize)-1):
        if (lot == prize[i]):
            money+=prize[-1]
  return money
def big_prizes (lot,prizes):
    money=0
    for i in prizes:
        for j in range(len(i)-1):
            if lot == i[j]:
                money+=i[-1]
    return money
def next_to_first (lot,prize):
        if int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1:
          return prize[-1]
        return 0
def first_digits_check(lot,prize):
  money = 0
  for i in prize[:-1]:
    if lot[:3] == i:
      money+=prize[-1]
  return money
def last_digits_check(lot,prize):
    money = 0
    for i in prize[:-1]:
        if len(i)== 2 and lot[-2:] == i:
            money+=prize[-1]
        if len(i)== 3 and lot[-3:] == i:
            money+=prize[-1]
    return money
def digit_prizes (lot,prizes):
        return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6531025521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 592, 'const': 824, 'code+const': 1416}
def prize_check (lot,prize):
  x = 0
  for e in prize[:-1]:
      if e == lot:
        x += int(prize[-1])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  x = 0
  for prize in prizes:
    x += prize_check(lot,prize)
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  x = 0
  f,p = prize
  next = []
  if f == '000000':
    next += ['000001','999999']
  else:
    if f == '999999':
      next += ['000000','999998']
    else:
      next += [str(int(f)+1),str(int(f)-1)]
    for n in next:
      if lot == n:
        x += p
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  x = 0
  for n in prize[:-1]:
    if lot[:3] == n:
      x += prize[-1]
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  x = 0
  for n in prize[:-1]:
    if len(n) == 3:
      if lot[-3:] == n:
        x += prize[-1]
    elif len(n) == 2:
      if lot[-2:] == n:
        x += prize[-1]
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  x = 0
  for e in range(len(prizes)):
    if e == 0:
      x += first_digits_check(lot,prizes[e])
    else:
      x += last_digits_check(lot,prizes[e])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  x = 0
  x += big_prizes (lot,all_prizes[:5])
  x += next_to_first (lot,all_prizes[5])
  x += digit_prizes (lot,all_prizes[-3:])
  return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6531505421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 672, 'const': 964, 'code+const': 1636}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  x = len(prize)
  i = 0
  y= 0
  while True :
    if x == i:
      break
    if lot == prize[i]:
      y += (prize[x-1])
    i += 1
  return(y)
def big_prizes (lot,prizes):
  prize = prizes
  return(prize_check(lot,prize[0])+prize_check(lot,prize[1])+prize_check(lot,prize[2])+prize_check(lot,prize[3])+prize_check(lot,prize[4]))
def next_to_first (lot,prize):
    y = 0
    if prize[0] == '000000' :
        if lot == '999999' or '000001':
            y += prize[1]
    elif prize[0] == '100000' :
        if lot  == '999999' or '100001':
            y += prize[1]
    elif str(int(prize[0]) + 1) == lot :
        y += int(prize[1])
    elif str(int(prize[0]) - 1) == lot :
        y += int(prize[1])
    return (y)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  x = len(prize)
  i = 0
  y= 0
  while True :
    if x == i:
      break
    if lot[:3] == prize[i]:
        y += (prize[x-1])
    i += 1
  return(y)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  x = len(prize)
  i = 0
  y= 0
  z = len(prize[0])
  while True :
    if x == i:
      break
    if lot[-z:] == prize[i]:
        y += (prize[x-1])
    i += 1
  return(y)
def digit_prizes (lot,prizes):
    y= 0
    y += first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
    return(y)
def total_prize (lot,all_prizes):
    y= 0
    y += big_prizes (lot,all_prizes[:5])+digit_prizes (lot,all_prizes[6:])+next_to_first (lot,all_prizes[5])
    return(y)

6531809221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 558, 'const': 885, 'code+const': 1443}
def prize_check (lot,prize):
  money=0
  for i in range(len(prize)-1):
    if lot==prize[i]:
      money += prize[-1]
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  money=0
  for i in prizes:
    money += prize_check (lot,i)
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  money=0
  if prize[0]=="000000":
    lot1="999999"
    lot2="0000001"
  if prize[0]=="999999":
    lot1="999998"
    lot2="000000"
  else:
    lot1=str(int(prize[0])+1)
    lot2=str(int(prize[0])-1)
  if lot==lot1:
    money += prize[1]
  if lot==lot2:
    money += prize[1]
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  money=0
  for i in range(len(prize)-1):
    if lot[0:3]==prize[i]:
      money += prize[-1]
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  money1=0
  money2=0
  for i in range(len(prize)-1):
    if lot[-2:]==prize[i]:
      money1 += prize[-1]
    if lot[-3:]==prize[i]:
      money2 += prize[-1]
  return money1+money2
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  money=last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])+first_digits_check(lot,prizes[0])
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  money = big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630005921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 938, 'const': 988, 'code+const': 1926}
def prize_check(lot,prizes):
    data = []
    for i in prizes:
        if lot == i:
            data.append(prizes[-1])
    return sum(data)
def big_prizes(lot,prizes):
    data1 = []
    for i in prizes:
        for e in i:
            if lot == e:
                data1.append(i[-1])
    return sum(data1)
def next_to_first(lot,prizes):
    data2 = []
    for i in prizes:
        if str(int(lot) - 1) == i or str(int(lot) + 1) == i:
            data2.append(prizes[-1])
        elif lot == '999999' and i == '000000':
            data2.append(prizes[-1])
        elif lot == '000000' and i == '999999':
            data2.append(prizes[-1])
    return sum(data2)
def first_digits_check(lot,prizes):
    data3 = []
    for i in prizes:
        if lot[:3] == i:
            data3.append(prizes[-1])
    return sum(data3)
def last_digits_check(lot,prizes):
    data4 = []
    for i in prizes:
        if lot[3:] == i:
            data4.append(prizes[-1])
        if lot[4:] == i:
            data4.append(prizes[-1])
    return sum(data4)
def digit_prizes(lot,prizes):
    data5 = []
    for i in prizes[0]:
        if lot[:3] == i:
            data5.append(prizes[0][-1])
    for i in prizes[1]:
        if lot[3:] == i:
            data5.append(prizes[1][-1])
    for i in prizes[2]:
        if lot[4:] == i:
            data5.append(prizes[2][-1])
    return sum(data5)
def total_prize(lot,prizes):
    data6 = []
    for i in prizes[:5]:
        for e in i:
            if lot == e:
                data6.append(i[-1]) #big
    for i in prizes[5]:
        if str(int(lot) - 1) == i or str(int(lot) + 1) == i:
            data6.append(prizes[5][-1])
        elif lot == '999999' and i == '000000':
            data6.append(prizes[5][-1])
        elif lot == '000000' and i == '999999':
            data6.append(prizes[5][-1]) #next to first
    for i in prizes[6]:
        if lot[:3] == i:
            data6.append(prizes[6][-1])
    for i in prizes[7]:
        if lot[3:] == i:
            data6.append(prizes[7][-1])
    for i in prizes[8]:
        if lot[4:] == i:
            data6.append(prizes[8][-1]) #all digits
    return sum(data6)

6630013921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 744, 'const': 1052, 'code+const': 1796}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        n = 0
        for i in prize[-2::-1]:
          if i == lot:
            n += 1
        baht = prize[-1]*n
        return baht
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        baht = 0
        for i in range((len(prizes))):
          n = 0
          for k in prizes[i]:
            if k == lot:
              n += 1
          baht += prizes[i][-1]*n
        return baht
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if prize[0] == '000000':
          n = 0
          x = ['999999', '000001']
          for i in x:
            if i == lot:
              n += 1
          baht = prize[-1]*n
          return baht
        elif prize[0] == '999999':
          n = 0
          x = ['999998', '000000']
          for i in x:
            if i == lot:
              n += 1
          baht = prize[-1]*n
          return baht
        else:
          n = 0
          x = [str(int(prize[0])-1), str(int(prize[0])+1)]
          for i in x:
            if i == lot:
              n += 1
          baht = prize[-1]*n
          return baht
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        n = 0
        for i in prize[-2::-1]:
          if i == lot[0:3]:
            n += 1
        baht = prize[-1]*n
        return baht
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        n = 0
        if len(prize[0]) == 3:
          for i in prize[-2::-1]:
            if i == lot[3:]:
              n += 1
          baht = prize[-1]*n
          return baht
        else:
          for i in prize[-2::-1]:
            if i == lot[4:]:
              n += 1
          baht = prize[-1]*n
          return baht
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        prizefirst3 = prizes[0]
        prizelast3 = prizes[1]
        prizelast2 = prizes[2]
        baht = first_digits_check(lot,prizefirst3) + last_digits_check(lot,prizelast3) + last_digits_check(lot,prizelast2)
        return baht
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        baht = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
        return baht

6630016821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 430, 'const': 724, 'code+const': 1154}
def prize_check(lot, prize):
    total = 0
    for i in prize :
        if lot == i :
            total += prize[-1]
    return total
def big_prizes(lot, prizes):
    total = 0
    for i in prizes :
        total += prize_check(lot, i)
    return total
def next_to_first(lot, prize):
    if prize[0] == "999999" :
        prize = ["000000","999998",prize[-1]]
    elif prize[0] == "000000" :
        prize = ["999999", "000001", prize[-1]]
    else :
        prize = [str(int(prize[0])-1),str(int(prize[0])+1),prize[-1]]
    return prize_check(lot,prize)
def first_digits_check(lot, prize):
    lot = lot[:3]
    return  prize_check(lot,prize)
def last_digits_check(lot, prize):
    s3 = lot[3:]
    s2 = lot[4:]
    return prize_check(s3, prize) + prize_check(s2, prize)
def digit_prizes(lot, prizes):
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize(lot, all_prizes):
    return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6630017421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 540, 'const': 716, 'code+const': 1256}
def prize_check (lot,prize):
    p = 0
    ch = 1
    while ch < len(prize):
        if lot == prize[ch-1]:
            p += prize[-1]
        ch += 1
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    p = 0
    ch = 1
    prize = prizes
    for i in range(len(prizes)):
        p += prize_check(lot,prize[i])
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    c1,c2 = str((int(prize[0])+999999)%1000000),str((int(prize[0])+1000001)%1000000)
    if lot == c1 or lot == c2:
        return prize[1]
    else :
        return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    p = 0
    for ch in prize[:-1]:
        if ch == lot[:3]:
          p += prize[-1]
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    p = 0
    for ch in prize[:-1]:
        if ch == lot[-3:] or  ch == lot[-2:]:
          p += prize[-1]
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    prize = prizes
    p = first_digits_check(lot,prize[0])
    for i in range(len(prize)-1):
        p += last_digits_check(lot,prize[i+1])
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    p = 0
    p += big_prizes (lot,all_prizes[:5])
    p += next_to_first (lot,all_prizes[5])
    p += digit_prizes (lot,all_prizes[6:])
    return p
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630020221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 550, 'const': 884, 'code+const': 1434}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prize)-1):
      if lot == prize[i]: money += prize[-1]
    return money
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(5):
      money += prize_check(lot,prizes[i])
    return money
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if prize[0] == '999999': num = ['999998','000000']
    elif prize[0] == '000000': num = ['999999','000001']
    else: num = [str(int(prize[0])-1),str(int(prize[0])+1)]
    money = 0
    if lot == num[0] or lot == num[1]: money += prize[-1]
    return money
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prize)-1):
      if lot[0:3] == prize[i]: money += prize[-1]
    return money
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    money = 0
    for i in range(len(prize)-1):
      if lot[-len(prize[0]):] == prize[i]: money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    a = first_digits_check(lot,prizes[0])
    b = last_digits_check(lot,prizes[1])
    c = last_digits_check(lot,prizes[2])
    return a+b+c
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    a = big_prizes(lot,all_prizes[:5])
    b = next_to_first(lot,all_prizes[5])
    c = digit_prizes(lot,all_prizes[-3:])
    return a+b+c

6630023121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 580, 'const': 884, 'code+const': 1464}
def prize_check (lot,prize):
  sum = 0
  for i in prize:
    if i == lot:
      sum += prize[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
  sum = 0
  for i in prizes:
    for j in i:
      if j == lot:
        sum += i[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
  sum = 0
  if prize[0] == '999999':
    if lot == '999998' or lot == '000000':
      sum += prize[-1]
    if prize[0] == '000000':
      if lot == '000001' or lot == '999999':
        sum += prize[-1]
  else:
    if int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1:
      sum += prize[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  sum = 0
  for i in prize:
    if i == lot[:3]:
      sum += prize[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  sum = 0
  for i in prize:
    if i == lot[3:] or i == lot[4:]:
      sum += prize[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  sum = 0
  for i in prizes:
    for j in i:
      if lot[:3] == j:
        sum += i[-1]
      elif lot[3:] == j:
        sum += i[-1]
      elif lot[4:] == j:
        sum += i[-1]
  return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630029021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 606, 'const': 828, 'code+const': 1434}
def prize_check (lot,prize):
         # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
         # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
          sum=0
          for i in range(len(prize)-1):
            if lot==prize[i]:
              sum += prize[-1]
          return sum
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
          sum=0
          for i in prizes :
            for j in i[:-1]:
              if lot==j:
                sum += i[-1]
          return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
          sum=0
          if (int(lot) == int(prize[0])+1) or (int(lot) ==int(prize[0])-1):
              sum += prize[-1]
          return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
          sum=0
          for i in range(len(prize)-1):
            if lot[:3] == prize[i]:
              sum += prize[-1]
          return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
          sum=0
          for i in range(len(prize)-1):
            if (lot[3:] == prize[i]) or (lot[4:] == prize[i]):
              sum += prize[-1]
          return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
            sum=0
            for j in prizes[1]:
              if (lot[3:] == j):
                sum += prizes[1][-1]
            for j in prizes[2]:
              if (lot[4:] == j):
                sum += prizes[2][-1]
            for j in prizes[0]:
              if (lot[:3] == j):
                sum += prizes[0][-1]
            return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        sum=0
        sum+=big_prizes (lot,all_prizes[:5])
        sum+=next_to_first (lot,all_prizes[5])
        sum+=digit_prizes (lot,all_prizes[6:])
        return sum
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630030521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 0987, 987, 19874, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 942, 'const': 1136, 'code+const': 2078}
def prize_check (lot,prize):
    money = 0
    for i in range(0,len(prize)-1,1) :
        if lot == prize[i]:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
        money = 0
        for j in range(len(prizes)) :
            for i in range(0,len(prizes[j])-1,1) :
                if lot == prizes[j][i]:
                    money += prizes[j][-1]
        return money
def next_to_first (lot,prize):
        money = 0
        for i in range(0,len(prize)-1,1) :
            if lot == "000000" :
                if prize[i] == "999999" or "000001" :
                    money += prize[-1]
            if lot == "999999" :
                if prize[i] == "999998" or "000000" :
                    money += prize[-1]
            if str(int(lot)-1) == prize[i] :
                money += prize[-1]
            if str(int(lot)+1) == prize[i] :
                money += prize[-1]
        return money
def first_digits_check(lot,prize):
        money = 0
        for i in range(0,len(prize)-1,1) :
            if lot[0:3:1] == prize[i][0:3:1]:
                money += prize[-1]
        return money
def last_digits_check(lot,prize):
    money = 0
    for i in range(0,len(prize)-1,1) :
        if len(prize[0])==2 :
            if lot[-1:-3:-1] == prize[i][-1:-3:-1]:
                money += prize[-1]
        if len(prize[0])==3 :
            if lot[-1:-4:-1] == prize[i][-1:-4:-1] :
                money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    money = 0
    for j in range(len(prizes)) :
        for i in range(0,len(prizes[j])-1,1) :
            if j == 0 :
                if lot[0:3:1] == prizes[j][i][0:3:1]:
                    money += prizes[j][-1]
            if j == 1 :
                if len(prizes[j][0])==3 :
                    if lot[-1:-4:-1] == prizes[j][i][-1:-4:-1] :
                        money += prizes[j][-1]
            if j == 2 :
                if len(prizes[j][0])==2 :
                    if lot[-1:-3:-1] == prizes[j][i][-1:-3:-1]:
                        money += prizes[j][-1]
    return money
def total_prize (lot,all_prizes):
        return (big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])                  +digit_prizes(lot,all_prizes[6:]))

6630031121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 606, 'const': 688, 'code+const': 1294}
def prize_check(lot,prize):
    a=0
    money=prize[-1]
    for i in range(len(prize)):
        if prize[i] == lot :
            a+=money
        else:
            pass
    return a
def big_prizes (lot,prizes):
    x=0
    for i in range(len(prizes)):
        x+=prize_check(lot,prizes[i])
    return x
def next_to_first (lot,prize):
    x=0
    k=[int(prize[0])+1,int(prize[0])-1,prize[1]]
    for i in range(len(k)-1):
        k[i]=str(k[i])
    x+=prize_check(lot,k)
    return x
def first_digits_check(lot,prize):
    x=0
    for i in range(len(prize)-1):
        if lot[:3] in prize[i]:
            x+=prize[-1]
    return x
def last_digits_check(lot,prize):
    if len(prize[0]) != 2 :
        x=0
        for i in range(len(prize)-1):
            if lot[3:] in prize[i]:
                x+=prize[-1]
        return x
    else:
        x=0
        for i in range(len(prize)-1):
            if lot[4:] in prize[i]:
                x+=prize[-1]
        return x
def digit_prizes (lot,prizes):
    x=first_digits_check(lot,prizes[0])
    y=0
    for i in range(1,3):
        y+= last_digits_check(lot,prizes[i])
    return x+y
def total_prize (lot,all_prizes):
    i=big_prizes (lot,all_prizes[0:5])
    j=next_to_first (lot,all_prizes[5])
    k=digit_prizes (lot,all_prizes[6:])
    return i+j+k

6630034021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 632, 'const': 996, 'code+const': 1628}
def prize_check (lot,prize):
    money = prize[-1]
    c = 0
    for i in prize :
        if lot == i  :
            c +=1
    x = c*money
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    d=0
    for e in prizes :
        money = e[-1]
        for i in e :
            c=0
            if lot == i  :
                c +=1
            x = c*money
            d += x
    return d
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    money = prize[-1]
    x = 0
    if prize[0] == "000000" or prize[0] == "999999" :
        if prize[0] == "000000" :
            t = ["000001","999999"]
        else:
            t = ["000000","999998"]
    else :
        k = [int(prize[0])-1,int(prize[0])+1]
        t = [str(k[0]),str(k[1])]
    if lot in t :
        x = money
    return x
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    money = prize[-1]
    x = lot[0:3]
    c = 0
    for i in prize :
        if x == i :
            c+=1
        y = c*money
    return y
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    money = prize[-1]
    e = 0
    if len(prize[0]) == 3:
        for i in prize :
            if i == lot[-3:] :
                e+=1
    else :
        for i in prize :
            if i == lot[-2:] :
                e+=1
    k = e*money
    return k
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    k = last_digits_check (lot,prizes[1])
    l = first_digits_check (lot,prizes[0])
    p = last_digits_check (lot,prizes[2])
    n =  k + l + p
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    a = digit_prizes (lot,all_prizes[6:])
    b = big_prizes (lot,all_prizes[:5])
    c = next_to_first (lot,all_prizes[5])
    n =  a + b + c
    return n
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630037021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 614, 'const': 800, 'code+const': 1414}
def prize_check(lot,prize):
    c = 0
    for i in range(len(prize)-1):
       if lot == prize[i]:
          c += prize[-1]
    return c
#--------------------------------------------
def big_prizes(lot,prize):
    money = 0
    for i in range(5):
        money += prize_check(lot,prize[i])
    return money
#--------------------------------------------
def next_to_first(lot,prize):
    money = 0
    leftlot = str(int(lot)-1)
    rightlot = str(int(lot)+1)
    if leftlot in prize[:len(prize)-1:]         or rightlot in prize[:len(prize)-1:]:
        money += prize[-1]
    return money
#--------------------------------------------
def first_digits_check(lot,prize):
    #เลขหน้า 3 ตัว
    firstdigit = str(int(lot)//1000)
    c = 0
    for i in range(len(prize)-1):
       if firstdigit == prize[i]:
          c += prize[-1]
    return c
#--------------------------------------------
def last_digits_check(lot,prize):
    #เลขท้าย 3 ตัว
    lastdigit = str(int(lot)%1000)
    c = 0
    if len(prize[0]) == 3:
        for i in range(len(prize)-1):
           if lastdigit == prize[i]:
              c += prize[-1]
    #เลขท้าย 2 ตัว
    if len(prize[0]) == 2:
        lastdigit = str(int(lot)%100)
        for i in range(len(prize)-1):
             if lastdigit == prize[i]:
                c += prize[-1]
    return c
#--------------------------------------------
def digit_prizes(lot,prize):
    money = 0
    money += (first_digits_check(lot,prize[0])+               last_digits_check(lot,prize[1])+               last_digits_check(lot,prize[2]))
    return money
#--------------------------------------------
def total_prize (lot,prize):
    money = 0
    money += (big_prizes(lot,prize)+               next_to_first(lot,prize[5])+               digit_prizes(lot,prize[6:]))
    return money

6630039221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 580, 'const': 940, 'code+const': 1520}
def prize_check (lot,prize):
        reward = 0
        for i in range(len(prize)-1):
          if lot == prize[i]:
            reward += prize[-1]
        return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
        reward = 0
        for i in range(5):
          reward += prize_check(lot,prizes[i])
        return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
        reward = 0
        if prize == '999999' and (lot == '999998' or lot == '000000') :
          reward += prize[-1]
        elif prize == '999999' and (lot == '999999' or lot == '000001'):
          reward += prize[-1]
        elif int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1:
          reward += prize[-1]
        return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
        reward = 0
        for i in range(len(prize)-1):
          if lot[:3] == prize[i]:
            reward += prize[-1]
        return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
        reward = 0
        for i in range(len(prize)-1):
          if lot[-3:] == prize[i] or lot[-2:] == prize[i] :
            reward += prize[-1]
        return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
        a = first_digits_check(lot,prizes[0])
        b = last_digits_check(lot,prizes[1])
        c = last_digits_check(lot,prizes[2])
        return a+b+c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
        a = big_prizes(lot,all_prizes[:5])
        b = next_to_first(lot,all_prizes[5])
        c = digit_prizes (lot,all_prizes[6:])
        return a+b+c
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630040821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 598, 'const': 772, 'code+const': 1370}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    m = 0
    for i in range(len(prize)-1) :
        if lot == prize[i] : m += prize[-1]
    return m
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    m = 0
    for k in prizes :
        m += prize_check(lot,k)
    return m
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if abs(int(lot)-int(prize[0])) == 1 : return prize[-1]
    else : return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    m = 0
    for i in range(len(prize)-1) :
        if lot[0:3] == prize[i] : m += prize[-1]
    return m
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    m = 0
    for i in range(len(prize)-1) :
        if lot[-len(prize[i]):] == prize[i] :
           m += prize[-1]
    return m
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    m = 0
    for i in range(len(prizes)) :
        for j in range(len(prizes[i])-1) :
           if lot[:3] == prizes[i][j] :
              m += prizes[i][-1]
           elif lot[-2:] == prizes[i][j] :
              m += prizes[i][-1]
           elif lot[-3:] == prizes[i][j] :
              m += prizes[i][-1]
    return m
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    m = 0
    m += big_prizes(lot,all_prizes[0:5])
    m += next_to_first(lot,all_prizes[5])
    m += first_digits_check(lot,all_prizes[6])
    m += digit_prizes (lot,all_prizes[7:])
    return m

6630042021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 740, 'const': 884, 'code+const': 1624}
def prize_check (lot,prize):
    if lot in prize:
        reward=prize[-1]
        b=prize.count(lot)
        sum=reward*b
    else :
        sum=0
    return sum
def big_prizes (lot,prize):
    sum=0
    for i in range(len(prize)):
       if lot in prize[i]:
          reward=prize[i][-1]
          b=prize[i].count(lot)
          sum+=reward*b
       else :
          sum+=0
    return sum
def next_to_first (lot,prize):
    if int(lot[0]) == 0:
        L=999999
        R=1
    if int(lot[0]) == 999999:
        L=999998
        R=0
    else:
        L=int(lot)-1
        R=int(lot)+1
    if int(prize[0]) == L or int(prize[0]) == R:
        sum = prize[-1]
    else:
        sum=0
    return sum
def first_digits_check(lot,prize):
    if lot[0:3] in prize:
        reward=prize[-1]
        b=prize.count(lot[0:3])
        ans=reward*b
    else :
        ans=0
    return ans
def last_digits_check(lot,prize):
    ans=0
    if lot[-2:] in prize:
        reward=prize[-1]
        b=prize.count(lot[-2:])
        ans+=reward*b
    if lot[-3:] in prize:
        reward=prize[-1]
        b=prize.count(lot[-3:])
        ans+=reward*b
    return ans
def digit_prizes (lot,prizes):
    ans1=first_digits_check(lot,prizes[0])
    ans2=last_digits_check(lot,prizes[1])
    ans3=last_digits_check(lot,prizes[2])
    sum=ans1+ans2+ans3
    return sum
def total_prize(lot,all_prizes):
    sum=0
    sum+=prize_check (lot,all_prizes[0])
    sum+=prize_check (lot,all_prizes[1])
    sum+=prize_check (lot,all_prizes[2])
    sum+=prize_check (lot,all_prizes[3])
    sum+=prize_check (lot,all_prizes[4])
    sum+=next_to_first(lot,all_prizes[5])
    sum+=first_digits_check(lot,all_prizes[6])
    sum+=last_digits_check(lot,all_prizes[7])
    sum+=last_digits_check(lot,all_prizes[8])
    return sum

6630044321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 590, 'const': 796, 'code+const': 1386}
def prize_check (lot,prize):
    money = 0
    for cons in prize[:-1] :
        if lot == cons :
            money += int(prize[-1])
    return money
def big_prizes (lot,prizes):
    money = 0
    for prize in prizes :
        money += prize_check(lot, prize)
    return money
def next_to_first (lot,prize):
    money = 0
    sub_prize = []
    first,m = prize
    if first == '000000' :
        sub_prize += ['999999','000001']
    elif first == '999999' :
        sub_prize += ['999998','000000']
    else :
        sub_prize += [str(int(first)-1),str(int(first)+1)]
    for cons in sub_prize :
        if lot == cons :
            money += m
    return money
def first_digits_check(lot,prize):
    money = 0
    for cons in prize[:-1]:
        if lot[:3] == cons :
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    for cons in prize[:-1]:
        if len(cons) == 3:
            if lot[3:] == cons :
                money += prize[-1]
        elif len(cons) == 2:
            if lot[4:] == cons :
                money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    money = 0
    for i in range(len(prizes)):
        if i == 0  :
          money += first_digits_check(lot,prizes[i])
        else:
          money += last_digits_check(lot,prizes[i])
    return money
def total_prize (lot,all_prizes):
    money = 0
    money += big_prizes(lot,all_prizes[:5])
    money += next_to_first(lot,all_prizes[5])
    money += digit_prizes (lot,all_prizes[6:])
    return money

6630049521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 846, 'const': 1217, 'code+const': 2063}
def prize_check (lot:str, prize:list) -> int:
    return prize[-1] * prize.count(lot) if lot in [e for e in prize[:-1]] else 0
def big_prizes (lot:str, prizes:list) -> int:
    return sum([prize_check(lot,e) for e in prizes])
def next_to_first (lot:str, prize:list) -> int:
    if prize[0] == '999999':
        return prize[-1] if lot == '000000' or lot == '999998' else 0
    if prize[0] == '000000':
        return prize[-1] if lot == '999999' or lot == '000001' else 0
    return prize[-1] if int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1 else 0
def first_digits_check(lot:str, prize:list) -> int:
    return prize[-1] * ["{}".format(e[:3]) for e in prize[:-1]].count(lot[:3]) if lot[:3] in ["{}".format(e[:3]) for e in prize[:-1]] else 0
def last_digits_check(lot:str, prize:list) -> int:
    if len(prize) == 3:
        return prize[-1] * ["{}".format(e) for e in prize[:-1]].count(lot[3:]) if lot[3:] in ["{}".format(e) for e in prize[:-1]] else 0
    return prize[-1] * ["{}".format(e) for e in prize[:-1]].count(lot[4:]) if lot[4:] in ["{}".format(e) for e in prize[:-1]] else 0
def digit_prizes (lot:str, prizes:list) -> int:
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot:str,all_prizes) -> int:
    return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6630050021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 716, 'code+const': 1310}
def prize_check(lot,prize):
    a = 0
    for i in range(len(prize)-1):
        if lot in prize[i]:
            a += int(prize[-1])
    return a
def big_prizes (lot,prizes):
    b = 0
    for i in range(len(prizes)):
        b += prize_check(lot,prizes[i])
    return b
def next_to_first (lot,prize):
    c = 0
    for i in range(len(prize)-1):
        if abs(int(lot)-int(prize[i])) == 1:
            c +=int(prize[-1])
    return c
def first_digits_check(lot,prize):
    d = 0
    lot = lot[:3]
    for i in range(len(prize)-1):
        if lot in prize[i]:
            d +=int(prize[-1])
    return d
def last_digits_check(lot,prize):
    e = 0
    if len(prize[0]) == 3:
        lot = lot[-3:]
        for i in range(len(prize)-1):
            if lot in prize[i]:
                e += prize[-1]
    else :
        lot = lot[-2:]
        for i in range(len(prize)-1):
            if lot in prize[i]:
                e += prize[-1]
    return e
def digit_prizes (lot,prizes):
    f = 0
    f +=first_digits_check(lot,prizes[0])
    for i in range(1,len(prizes)):
        f += last_digits_check(lot,prizes[i])
    return f
def total_prize (lot,all_prizes):
    j = big_prizes (lot,all_prizes[0:5])
    j += next_to_first (lot,all_prizes[5])
    j +=digit_prizes (lot,all_prizes[6:])
    return j

6630052321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_20.0
[0, 7142, 7142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 628, 'const': 852, 'code+const': 1480}
def prize_check(lot,all_prizes) :
    reward=0
    for i in all_prizes[:-1] :
        if i == lot :
            reward+=all_prizes[-1]
    return reward
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def big_prizes(lot,all_prizes) :
    gratuity=0
    for e in all_prizes :
        gratuity+=prize_check(lot,e)
    return gratuity
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def next_to_first(lot,all_prizes) :
    reward=all_prizes[0]
    if '000000' == all_prizes[0]  :
        if lot == '000001' or lot == '999999' :
            return all_prizes[-1]
    elif '999999' == all_prizes[0] :
        if lot == '000000' or lot == '999998' :
             return all_prizes[-1]
    #elif lot == reward[0:-1]+str(int(reward[-1])-1) or lot == reward[0:-1]+str(int(reward[-1])+1) :
    elif int(lot) ==int(reward)-1 or int(lot) == int(reward)+1 :
        return all_prizes[-1]
    return 0
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def first_digits_check(lot,all_prizes) :
    if lot[:3] == all_prizes[0] or lot[:3] == all_prizes[1] :
        return all_prizes[-1]
    else :
        return 0
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def last_digits_check(lot,all_prizes) : #['777', '888', 4000],['55', 2000]
    reward=0
    if not len(all_prizes[0])%2 == len(str(all_prizes[1]))%2 :
        for i in all_prizes :
            for e in i[:-1] :
                if e == lot[-len(i):] :
                    reward+=i[-1]
    else :
        for i in all_prizes[:-1] :
            if i == lot[-len(i):] :
                reward+=all_prizes[-1]
    return reward
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def digit_prizes(lot,all_prizes) :
    gratuity=0
    gratuity+=first_digits_check(lot,all_prizes[0])
    gratuity+=last_digits_check(lot,all_prizes[1:])
    return gratuity
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def total_prize(lot,all_prizes) :
    gratuity=0
    gratuity+=big_prizes(lot,all_prizes[:5])
    gratuity+=next_to_first(lot,all_prizes[5])
    gratuity+=digit_prizes(lot,all_prizes[6:])
    return gratuity
#-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

6630057521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 646, 'const': 1049, 'code+const': 1695}
def prize_check (lot,prize):
    n = 0
    for i in range(len(prize)):
        if lot == prize[i]:
            n += 1
    cash = n*prize[-1]
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    cash = 0
    for i in range(len(prizes)):
        a = prize_check(lot,prizes[i])
        cash += a
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    cash = 0
    if prize[0] == "000000" :
        a = "9  99999" ; b = "000001"
    elif prize[0] == "999999":
        a = "999998" ; b = "000000"
    else :
        prize[0] = int(prize[0])
        a = str(prize[0]-1) ; b = str(prize[0]+ 1)
    Xprize = [a,b,prize[-1]]
    cash += prize_check(lot,Xprize)
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check (lot,prize):
    cash = 0
    for i in range(len(prize)-1):
        if lot[:3] == prize[i]:
            cash += prize[-1]
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check (lot,prize):
    cash = 0
    for i in range(len(prize)-1):
        if len(prize[0]) == 2:
            if lot[-2:] == prize[i]:
                cash += prize[-1]
        elif len(prize[0]) == 3:
            if lot[-3:] == prize[i]:
                cash += prize[-1]
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    cash = 0
    f = first_digits_check(lot,prizes[0])
    l2 = last_digits_check(lot,prizes[1])
    l3 = last_digits_check(lot,prizes[2])
    cash += f + l2 + l3
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    cash = 0
    big = big_prizes(lot,all_prizes[:5])
    next = next_to_first(lot,all_prizes[5])
    digi = digit_prizes(lot,all_prizes[6:])
    cash += big + next + digi
    return cash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630066121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 680, 'const': 540, 'code+const': 1220}
def prize_check (lot,prize):
    sum_prizes = []
    for e in prize[:-1] :
        if lot == e :
            sum_prizes.append(prize[-1])
    return(sum(sum_prizes))
def big_prizes (lot,prizes):
    sum_prizes = []
    for k in range(len(prizes)) :
        for e in prizes[k][:-1] :
            if lot == e :
                sum_prizes.append(prizes[k][-1])
    return(sum(sum_prizes))
def next_to_first (lot,prize):
    next_first = [str(int(prize[0])-1),str(int(prize[0])+1)]
    sum_prizes = []
    for e in next_first :
        if lot == e :
            sum_prizes.append(prize[-1])
    return(sum(sum_prizes))
def first_digits_check(lot,prize):
    sum_prizes = []
    for e in prize[:-1] :
        if lot[:3] == e :
            sum_prizes.append(prize[-1])
    return(sum(sum_prizes))
def last_digits_check(lot,prize):
    sum_prizes = []
    for e in prize[:-1] :
        if lot[-len(e):] == e :
            sum_prizes.append(prize[-1])
    return(sum(sum_prizes))
def digit_prizes (lot,prizes):
    sum_prizes = []
    for e in prizes[0][:-1] :
        if lot[:3] == e :
            sum_prizes.append(prizes[0][-1])
    for e in prizes[1][:-1] :
        if lot[-len(e):] == e :
            sum_prizes.append(prizes[1][-1])
    for e in prizes[2][:-1] :
        if lot[-len(e):] == e :
            sum_prizes.append(prizes[2][-1])
    return(sum(sum_prizes))
def total_prize (lot,all_prizes):
    sum_prizes = []
    sum_prizes.append(big_prizes(lot,all_prizes[:5]))
    sum_prizes.append(next_to_first(lot,all_prizes[5]))
    sum_prizes.append(digit_prizes (lot,all_prizes[6:]))
    return(sum(sum_prizes))

6630069021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 496, 'const': 664, 'code+const': 1160}
def prize_check (lot,prize):
    m = 0
    for i in prize[:-1:]:
        if lot == i:
            m += prize[-1]
    return m
def big_prizes (lot,prizes):
    m = 0
    for i in prizes:
        m += prize_check(lot,i)
    return m
def next_to_first (lot,prize):
    l = [str(int(prize[0]) + 1),str(int(prize[0]) - 1)]
    m = 0
    for i in l:
        if lot == i:
            m += prize[-1]
    return m
def first_digits_check(lot,prize):
    m = 0
    for i in prize[:-1:]:
        if lot[:3:] == i:
            m += prize[-1]
    return m
def last_digits_check(lot,prize):
    m = 0
    if len(prize[0]) == 3:
        for i in prize:
            if lot[-3::] == i:
                m += prize[-1]
    if len(prize[0]) == 2:
        for i in prize:
            if lot[-2::] == i:
                m += prize[-1]
    return m
def digit_prizes (lot,prizes):
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) +             last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
    return big_prizes(lot,all_prizes[:5:]) + next_to_first(lot,all_prizes[5]) +             digit_prizes(lot,all_prizes[6::])

6630076421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 524, 'const': 660, 'code+const': 1184}
def prize_check (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    price = 0
    if lot in prizes :
        price = prizes[-1]
        n = prizes.count(lot)
        price = price*n
    return price
def big_prizes (lot,prizes):
    sum_n = 0
    price = 0
    for e in prizes:
        if lot in e :
            price = e[-1]
            n = e.count(lot)
            price = price*n
            sum_n +=price
    return sum_n
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    price = 0
    if int(lot) == int(prize[0])-1 or int(lot) == int(prize[0])+1 :
        price += prize[-1]
    return price
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    price = 0
    for i in range(len(prize[:-1])) :
        if lot[0:3] == prize[i]:
            price += prize[-1]
    return price
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    price = 0
    for i in range(len(prize[:-1])) :
        if lot[4:] == prize[i]:
            price += prize[-1]
        if lot[3:] == prize[i]:
            price += prize[-1]
    return price
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
   price = 0
   price = first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
   return(price)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    a = big_prizes(lot,all_prizes[0:5])
    b = next_to_first(lot,all_prizes[5])
    c = digit_prizes(lot,all_prizes[6:])
    return a+b+c

6630081521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 728, 'const': 936, 'code+const': 1664}
def prize_check (lot,prize):
    lot=str(lot)
    get=0
    for e in range(len(prize)-1):
        if lot==prize[e] :
            get+=int(prize[-1])
    return get
def big_prizes (lot,prizes):
    lot=str(lot)
    get=0
    for i in range(len(prizes)):
        for e in range(len(prizes[i])-1):
            if lot==prizes[i][e]:
                get+=int(prizes[i][-1])
    return get
def next_to_first (lot,prize):
    lot=str(lot)
    get=0
    for e in range(len(prize)-1):
        prize[e]=str(prize[e])
        if prize[e]=="000000":
            top="000001"
            bottom="999999"
        elif prize[e]=="999999":
            top="000000"
            bottom="999998"
        else:
            prize[e]=int(prize[e])
            top=str(prize[e]+1)
            bottom=str(prize[e]-1)
        if lot==top or lot==bottom :
            get+=int(prize[-1])
        else:pass
    return get
def first_digits_check(lot,prize):
    lot=str(lot)
    first_lot=lot[:3]
    get=0
    for e in range(len(prize)-1):
        if first_lot==prize[e] :
            get+=int(prize[-1])
    return get
def last_digits_check(lot,prize):
    lot=str(lot)
    get=0
    n=len(prize[0])
    last_lot=lot[-n:]
    for e in range(len(prize)-1):
        if last_lot==prize[e] :
            get+=int(prize[-1])
    return get
def digit_prizes (lot,prizes):
    first=first_digits_check(lot,prizes[0])
    last1=last_digits_check(lot,prizes[1])
    last2=last_digits_check(lot,prizes[2])
    get=int(first)+int(last1)+int(last2)
    return get
def total_prize (lot,all_prizes):
    get=0
    get+=big_prizes(lot,all_prizes[:5])
    get+=next_to_first(lot,all_prizes[5])
    get+=digit_prizes(lot,all_prizes[6:])
    return get

6630083821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 846, 'const': 856, 'code+const': 1702}
def prize_check (lot,prize):
    j = 0
    reward = 0
    for j in range(len(prize)-1):
        if lot == prize[j]:
            reward += prize[-1]
        else:
            reward += 0
        j+=1
    return(reward)
def big_prizes (lot,prizes):
    i = 0
    j = 0
    reward = 0
    for i in range(len(prizes)):
        x = prizes[i]
        for j in range(len(x)-1):
            if lot == x[j]:
                reward += x[-1]
            else:
                reward += 0
            j+=1
        i+=1
    return(reward)
def next_to_first (lot,prize):
    j = 0
    reward = 0
    for j in range(len(prize)-1):
        if int(lot) - int(prize[0]) == 1:
            reward += prize[-1]
        elif int(lot) - int(prize[0]) == -1:
            reward += prize[-1]
        else:
            reward += 0
        j+=1
    return(reward)
def first_digits_check(lot,prize):
    j = 0
    reward = 0
    for j in range(len(prize)-1):
        if lot[:3] == prize[j]:
            reward += prize[-1]
        else:
            reward += 0
        j+=1
    return(reward)
def last_digits_check(lot,prize):
    j = 0
    reward = 0
    for j in range(len(prize)-1):
        if lot[-3:] == prize[j]:
            reward += prize[-1]
        elif lot[-2:] == prize[j]:
            reward += prize[-1]
        else:
            reward += 0
        j+=1
    return(reward)
def digit_prizes (lot,prizes):
    i = 0
    j = 0
    reward = 0
    for i in range(len(prizes)):
        x = prizes[i]
        for j in range(len(x)-1):
            if lot[:3] == x[j]:
                reward += x[-1]
            elif lot[-3:] == x[j]:
                reward += x[-1]
            elif lot[-2:] == x[j]:
                reward += x[-1]
            else:
                reward += 0
            j+=1
        i+=1
    return(reward)
def total_prize (lot,all_prizes):
    reward = 0
    reward += big_prizes(lot,all_prizes[:5])
    reward += next_to_first(lot,all_prizes[5])
    reward += digit_prizes(lot,all_prizes[6:])
    return(reward)

6630084421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 866, 'const': 772, 'code+const': 1638}
def prize_check (lot,prize):
    money = 0
    n = 0
    while lot in prize:
        money += prize[-1]
        prize.remove(lot)
        n += 1
    while n > 0:
        prize.insert(0,lot)
        n -= 1
    return money
def big_prizes (lot,prizes):
    money = 0
    n = 0
    for i in range(len(prizes)):
        while lot in prizes[i]:
            money += prizes[i][-1]
            prizes[i].remove(lot)
            n += 1
        while n > 0:
            prizes[i].insert(0,lot)
            n -= 1
    return money
def next_to_first (lot,prize):
    money = 0
    if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1:
        money += prize[-1]
    return money
def first_digits_check(lot,prize):
    money = 0
    n = 0
    while lot[0:3] in prize:
        money += prize[-1]
        prize.remove(lot[0:3])
        n += 1
    while n > 0:
        prize.insert(0,lot[0:3])
        n -= 1
    return money
def last_digits_check(lot,prize):
    money = 0
    n = 0
    if lot[-3:] in prize:
        while lot[-3:] in prize:
            money += prize[-1]
            prize.remove(lot[-3:])
            n += 1
        while n > 0:
            prize.insert(0,lot[-3:])
            n -= 1
    if lot[-2:] in prize:
        while lot[-2:] in prize:
            money += prize[-1]
            prize.remove(lot[-2:])
            n += 1
        while n > 0:
            prize.insert(0,lot[-2:])
            n -= 1
    return money
def digit_prizes (lot,prize):
    money =  first_digits_check(lot,prize[0])+last_digits_check(lot,prize[1])+last_digits_check(lot,prize[2])
    return money
def total_prize (lot,all_prizes):
    money = big_prizes(lot,all_prizes[0:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
    return money

6630085021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 578, 'const': 804, 'code+const': 1382}
def prize_check (lot,prize):
        a=0
        for i in range(len(prize)) :
            if lot == prize[int(i)]:
                a+=prize[-1]
        return a
def big_prizes (lot,prizes):
    a=prize_check(lot,prizes[0])
    b=prize_check(lot,prizes[1])
    c=prize_check(lot,prizes[2])
    d=prize_check(lot,prizes[3])
    e=prize_check(lot,prizes[4])
    return a+b+c+d+e
def next_to_first (lot,prize):
    a=int(prize[0])-1
    b=int(prize[0])+1
    y=[a,b]
    g=int(lot)
    if g in y:
        return prize[-1]
    else:
        return 0
def first_digits_check(lot,prize):
    a=0
    for i in range(len(prize)) :
        if lot[:3] == prize[int(i)]:
            a+=prize[-1]
    return a
def last_digits_check(lot,prize):
    a=0
    for i in range(len(prize)) :
        if lot[-3:] == prize[int(i)] or lot[-2:]== prize[int(i)] :
            a+=prize[-1]
    return a
def digit_prizes (lot,prizes):
    a= first_digits_check(lot[:3],prizes[0])
    b=last_digits_check(lot[-3:],prizes[1])
    c=last_digits_check(lot[-2:],prizes[2])
    return a+b+c
def total_prize (lot,all_prizes):
    a=big_prizes (lot,all_prizes[:5])
    b=next_to_first (lot,all_prizes[5])
    c=digit_prizes (lot,all_prizes[6:])
    return a+b+c

6630086721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 552, 'const': 773, 'code+const': 1325}
def prize_check (lot,prize):
  c = 0
  for e in range(len(prize)):
    if lot == prize[e]:
      c += prize[-1]
  return c
def big_prizes (lot,prizes):
  c = 0
  for e in range(len(prizes)):
    c += prize_check(lot,prizes[e])
  return c
def next_to_first (lot,prize):
  c = 0
  if int(lot) == int(prize[0]) - 1:
    c += prize[-1]
  if int(lot) == int(prize[0]) + 1 and int(lot) != 1:
    c += prize[-1]
  if prize[0] == "000000":
    if lot == "000001" or lot == "999999":
      c += prize[1]
  return c
def first_digits_check(lot,prize):
  c = 0
  for e in range(len(prize)):
      if lot[:3] == prize[e]:
          c += prize[-1]
  return c
def last_digits_check(lot,prize):
  c = 0
  for e in range(len(prize)):
      if lot[3:] == prize[e]:
          c += prize[-1]
      if lot[4:] == prize[e]:
          c += prize[-1]
  return c
def digit_prizes (lot,prizes):
  c = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
  return c
def total_prize (lot,all_prizes):
  total = big_prizes (lot,all_prizes[:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
  return total

6630088021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 552, 'const': 660, 'code+const': 1212}
def prize_check (lot,prize):
    a=0
    for i in range(len(prize[:-1])):
        if lot in prize[i]:
           a+=prize[-1]
    return(a)
def big_prizes (lot,prizes):
    a=0
    for i in range(len(prizes)):
        for j in  range(len(prizes[i][:-1])):
            if lot in prizes[i][j]:
                 a+=prizes[i][-1]
    return a
def next_to_first (lot,prize):
    a=0
    if int(lot) == int(prize[0])+1 or int(lot)==int(prize[0])-1:
        a+=prize[-1]
    return a
def first_digits_check(lot,prize):
    a=0
    for i in range(len(prize[:-1])):
        if lot[0:3]==prize[i]:
            a+=prize[-1]
    return a
def last_digits_check(lot,prize):
    a=0
    for i in range (len(prize[:-1])):
        if lot[4:]==prize[i]:
          a+=prize[-1]
        if lot[3:]==prize[i]:
          a+=prize[-1]
    return a
def digit_prizes (lot,prizes):
    c=first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
    return c
def total_prize (lot,all_prizes):
    c=big_prizes(lot,all_prizes[0:5])+digit_prizes (lot,all_prizes[6:])+next_to_first(lot,all_prizes[5])
    return c

6630090121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 658, 'const': 828, 'code+const': 1486}
def prize_check (lot,prize):
        sum=0
        for i in range(len(prize)-1):
            if lot==prize[i]:
                sum+=prize[-1]
        return sum
def big_prizes (lot,prizes):
        sum=0
        for i in range(len(prizes)):
            for k in prizes[i]:
                if lot==k:
                    sum+=prizes[i][-1]
        return sum
def next_to_first (lot,prize):
        sum=0
        for i in range(len(prize)-1):
            if str(int(lot)+1)==prize[i]:
                sum+=prize[-1]
            elif str(int(lot)-1)==prize[i]:
                sum+=prize[-1]
        return sum
def first_digits_check(lot,prize):
        sum=0
        for i in range(len(prize)-1):
            if lot[0:3]==prize[i]:
                sum+=prize[-1]
        return sum
def last_digits_check(lot,prize):
        sum=0
        for i in range(len(prize)-1):#เลขท้าย3ตัว
            if lot[3:]==prize[i]:
                sum+=prize[-1]
        for i in range(len(prize)-1):#เลขท้าย2ตัว
            if lot[4:]==prize[i]:
                sum+=prize[-1]
        return sum
def digit_prizes (lot,prizes):
        sum=0
        sum+=first_digits_check(lot,prizes[0])
        sum+=last_digits_check(lot,prizes[1])
        sum+=last_digits_check(lot,prizes[2])
        return sum
def total_prize (lot,all_prizes):
        sum=0
        for i in range(len(all_prizes)-4):#ตั้งแต่รางวัล1-5
            sum+=prize_check(lot,all_prizes[i])
        sum+=next_to_first(lot,all_prizes[5])#รางวัลข้างเคียง1
        sum+=first_digits_check(lot,all_prizes[6])#รางวัลเลขหน้า3ตัว
        sum+=last_digits_check(lot,all_prizes[7])#รางวัลเลขท้าย3ตัว
        sum+=last_digits_check(lot,all_prizes[8])#รางวัลเลขท้าย2ตัว
        return sum

6630099921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 492, 'const': 632, 'code+const': 1124}
def prize_check (lot,prize):
    allmoney = 0
    for i in prize[:-1]:
        if lot == i:
            allmoney += prize[-1]
    return allmoney
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    allmoney = 0
    for i in prizes:
        allmoney += prize_check(lot,i)
    return allmoney
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1):
        return prize[1]
    return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    allmoney = 0
    for i in prize[:-1]:
        if lot[:3] == i:
            allmoney += prize[-1]
    return allmoney
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    if len(prize[0]) == 3:
        allmoney =0
        for i in prize[:-1]:
            if lot[3:] == i:
                allmoney += prize[-1]
        return allmoney
    else:
        allmoney =0
        if prize[0] == lot[4:]:
            return prize[1]
        else:
            return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    allmoney = 0
    allmoney+= first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) +                 last_digits_check(lot,prizes[2])
    return allmoney
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    allmoney = 0
    allmoney += big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) +               digit_prizes(lot,all_prizes[6:])
    return allmoney
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630180021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 604, 'const': 800, 'code+const': 1404}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  if lot in prize:
    return prize[-1]*prize.count(lot)
  else:
    return 0
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  win_prizes = 0
  for i in range(len(prizes)):
    if lot in prizes[i]:
      temp = prizes[i]
      win_prizes += prizes[i][-1]*temp.count(lot)
  return win_prizes
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  if prize[0] == '000000':
    if lot == ('000001' or '999999'):
      return prize[-1]
    else:
      return 0
  elif prize[0] == '999999':
    if lot == ('999998' or '000000'):
      return prize[-1]
    else:
      return 0
  else:
    if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1):
      return prize[-1]
    return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  lot_f_digit = lot[:3]
  if lot_f_digit in prize:
    return prize[-1]*prize.count(lot_f_digit)
  else:
    return 0
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  win_prizes = 0
  if isinstance(prize[0],list):
    for i in range(len(prize)):
     if lot[i-3:] in prize[i]:
      temp = prize[i]
      win_prizes += prize[i][-1]*temp.count(lot[i-3:])
  else:
    if lot[-len(prize[0]):] in prize:
      win_prizes += prize[-1]*prize.count(lot[-len(prize[0]):])
  return win_prizes
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
  return first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1:])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  return big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])+digit_prizes(lot,all_prizes[6:])

6630328621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 556, 'const': 688, 'code+const': 1244}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    a=0
    for i in range(len(prize)-1):
        if prize[i]==lot:
            a+=int(prize[-1])
    return a
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        a=0
        for i in range(len(prizes)):
            a += prize_check (lot,prizes[i])
        return a
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        a=0
        if int(prize[0])-1==int(lot):
            a+=int(prize[1])
        if int(prize[0])+1==int(lot):
            a+=int(prize[1])
        return a
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        a=0
        for i in range(len(prize)-1):
            if prize[i]==lot[:3]:
                a+=prize[-1]
        return a
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        a=0
        for i in range(len(prize)-1):
            if prize[i]==lot[3:]:
                a+=prize[-1]
            if prize[i]==lot[4:]:
                a+=prize[-1]
        return a
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        a=0
        a+=first_digits_check(lot,prizes[0])
        a+=last_digits_check(lot,prizes[1])
        a+=last_digits_check(lot,prizes[2])
        return a
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a=0
        a+=big_prizes(lot,all_prizes[:5])
        a+=next_to_first(lot,all_prizes[5])
        a+=digit_prizes(lot,all_prizes[6:])
        return a

6630358421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 652, 'const': 720, 'code+const': 1372}
def prize_check (lot,prize):
    x = len(prize)
    ap = 0
    for i in prize[:x-1]:
        if lot == i:
                pc = prize[-1]
                ap = ap+pc
        else:
                pc = 0
                ap = ap+pc
    return ap
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    ap = 0
    for prize in prizes:
        for i in prize[:-1]:
            if lot == i:
                bp = prize[-1]
                ap = ap+bp
            else:
                bp = 0
                ap = ap+bp
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    return ap
def next_to_first (lot,prize):
    n_first =[str(int(prize[0])-1), str(int(prize[0])+1)]
    for i in n_first:
        if lot == i:
            nfp = prize[-1]
            break
        else:
            nfp = 0
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    return nfp
def first_digits_check(lot,prize):
    ap = 0
    x = len(prize)
    for i in prize[:x-1]:
        if lot[:3] == i:
            bp = prize[-1]
            ap = ap+bp
        else:
            bp = 0
            ap=ap+bp
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    return ap
def last_digits_check(lot,prize):
    ap = 0
    if len(prize) > 2: #เช็คเลขท้าย 3 ตัว
        x = len(prize)
        for i in prize[:x-1]:
            if lot[3:] == i:
                bp = prize[-1]
                ap = ap+bp
            else:
                bp = 0
                ap=ap+bp
    else:               #เช็คเลขท้าย 2 ตัว
        if lot[4:] == prize[0]:
            bp = prize[-1]
            ap = ap+bp
        else:
            bp = 0
            ap=ap+bp
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    return ap
def digit_prizes (lot,prizes):
    ap = first_digits_check(lot,prizes[0])
    for prize in prizes[1:]:
        ap = ap+last_digits_check(lot,prize)
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    return ap
def total_prize (lot,all_prizes):
    aap = big_prizes(lot,all_prizes[:5]) #เช็ครางวัลใหญ่
    aap = aap + next_to_first(lot,all_prizes[5]) #เช็ครางวัลข้างเคียง
    aap = aap + digit_prizes (lot,all_prizes[6:]) #เช็ครางวัล 3 หน้า,หลัง และ 2 หลัง
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    return aap

6631009621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1216, 'const': 968, 'code+const': 2184}
def prize_check (lot,prize):
    win = 0
    for x in prize[:-1]:
        if lot == x:
            win += prize[-1]
    return(win)
def big_prizes (lot,prizes):
    win = 0
    for x in prizes:
        count = 0
        for i in x:
            if isinstance(i, str) ==  True:
                  count += 1
        for y in range(count):
            if lot == x[y]:
                win += x[-1]
    return(win)
def next_to_first (lot,prize):
    win = 0
    check_list = [int(prize[0])-1,int(prize[0])+1]
    if check_list[1] == 1000000:
         check_list[1] = 0
    if check_list[0] == -1:
         check_list[1] = 999999
    check_list = [str(i) for i in check_list]
    for x in check_list:
        if lot == x:
            win += prize[-1]
    return(win)
def first_digits_check(lot,prize):
        count = 0
        win = 0
        for i in prize:
            if isinstance(i, str) ==  True:
                  count += 1
        for x in range(count):
            if lot[0:len(prize[0])] == prize[x]:
                win += prize[-1]
        return(win)
def last_digits_check(lot,prize):
        count = 0
        win = 0
        for i in prize:
            if isinstance(i, str) ==  True:
                  count += 1
        for x in range(count):
            if lot[-len(prize[0]):] == prize[x]:
                win += prize[-1]
        return(win)
def digit_prizes (lot,prizes):
    win = 0
    test_counter = 0
    for x in prizes:
        if test_counter == 0:
            count = 0
            for i in x:
                if isinstance(i, str) ==  True:
                  count += 1
            for y in range(count):
                if lot[0:len(x[0])] == x[y]:
                    win += x[-1]
        else:
            count = 0
            for i in x:
                if isinstance(i, str) ==  True:
                  count += 1
            for y in range(count):
                if lot[-len(x[0]):] == x[y]:
                    win += x[-1]
        test_counter += 1
    return(win)
def total_prize (lot,all_prizes):
    win = 0
    test_counter = 0
    for x in all_prizes:
        if test_counter < 5:
            count = 0
            for i in x:
                if isinstance(i, str) ==  True:
                    count += 1
            for y in range(count):
                if lot == x[y]:
                    win += x[-1]
        if test_counter == 5:
            check_list = [int(x[0])-1,int(x[0])+1]
            if check_list[1] == 1000000:
                check_list[1] = 0
            if check_list[0] == -1:
                check_list[1] = 999999
            check_list = [str(i) for i in check_list]
            for y in check_list:
                if lot == y:
                    win += x[-1]
        if test_counter == 6:
            count = 0
            for i in x:
                if isinstance(i, str) ==  True:
                  count += 1
            for y in range(count):
                if lot[0:len(x[0])] == x[y]:
                    win += x[-1]
        if test_counter > 6:
            count = 0
            for i in x:
                if isinstance(i, str) ==  True:
                  count += 1
            for y in range(count):
                if lot[-len(x[0]):] == x[y]:
                    win += x[-1]
        test_counter += 1
    return(win)

6631011821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_10.0
[0, 0142, 0142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 514, 'const': 937, 'code+const': 1451}
def prize_check (lot:str,prize:list):
  money = 0
  for i in range(len(prize)-1):
    if lot == prize[i]:
      money = money + prize[-1]
  return money
def big_prizes (lot:str,prizes:list):
  money = 0
  for prize in prizes:
    money = money+prize_check(lot,prize)
  return money
def next_to_first (lot:str,prize:list):
  if prize[0] == '000000':
    if lot == '999999' or lot == '000001':
      return prize[-1]
    else :
      return 0
  elif prize[0] == '999999':
    if lot == '999998' or lot == '000000':
      return prize[-1]
    else:
      return 0
  else :
    if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1:
      return prize[-1]
    else:
      return 0
def first_digits_check(lot:str,prize:list):
  money = prize_check(lot[0:3],prize)
  return money
def last_digits_check(lot,prize):
  if len(prize) == 3:
    return prize_check(lot[3:],prize)
  else :
    return prize_check(lot[4:],prize)
def digit_prizes (lot,prizes):
  return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6631014721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 612, 'const': 908, 'code+const': 1520}
def prize_check (lot,prize):
        count = 0
        for i in prize:
            if type(i) == type('string'):
                if lot == i:
                    count = count + prize[-1]
        return count
def big_prizes (lot,prizes):
        count = 0
        for i in prizes:
            count = count + prize_check(lot,i)
        return count
def next_to_first (lot,prize):
        count = 0
        for i in prize:
            if type(i) == type('string'):
                if int(lot) - int(i) == 1 or int(i) - int(lot) == 1:
                    count = count + prize[-1]
        return count
def first_digits_check(lot,prize):
        count = 0
        for i in prize:
            if type(i) == type('string'):
                if lot[:3] == i[:3]:
                    count = count + prize[-1]
        return count
def last_digits_check(lot,prize):
        count = 0
        for i in prize:
            if type(i) == type('string'):
                if lot[len(lot)-2:] == i[len(i)-2:] or lot[len(lot)-3:] == i[len(i)-3:]:
                    count = count + prize[-1]
        return count
def digit_prizes (lot,prizes):
        count = 0
        count = count + first_digits_check(lot,prizes[0])
        count = count + last_digits_check(lot,prizes[1])
        count = count + last_digits_check(lot,prizes[2])
        return count
def total_prize (lot,all_prizes):
    count = 0
    count = count + big_prizes(lot,all_prizes[:5])
    count = count + next_to_first(lot,all_prizes[5])
    count = count + first_digits_check(lot,all_prizes[6])
    count = count + last_digits_check(lot,all_prizes[7])
    count = count + last_digits_check(lot,all_prizes[8])
    return count

6631022721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 680, 'const': 540, 'code+const': 1220}
def prize_check (lot,prize):
       s = []
       for a in prize[:-1] :
         if lot == a :
              s.append(prize[-1])
       return(sum(s))
def big_prizes (lot,prizes):
        s = []
        for b in range(len(prizes)) :
              for a in prizes[b][:-1] :
                    if lot == a :
                         s.append(prizes[b][-1])
        return(sum(s))
def next_to_first (lot,prize):
        n = [str(int(prize[0])-1),str(int(prize[0])+1)]
        s = []
        for a in n :
                if lot == a :
                     s.append(prize[-1])
        return(sum(s))
def first_digits_check(lot,prize):
        s = []
        for a in prize[:-1] :
              if lot[:3] == a :
                    s.append(prize[-1])
        return(sum(s))
def last_digits_check(lot,prize):
        s = []
        for a in prize[:-1] :
              if lot[-len(a):] == a :
                   s.append(prize[-1])
        return(sum(s))
def digit_prizes (lot,prizes):
        s = []
        for a in prizes[0][:-1] :
                if lot[:3] == a :
                        s.append(prizes[0][-1])
        for a in prizes[1][:-1] :
                if lot[-len(a):] == a :
                        s.append(prizes[1][-1])
        for a in prizes[2][:-1] :
                if lot[-len(a):] == a :
                        s.append(prizes[2][-1])
        return(sum(s))
def total_prize (lot,all_prizes):
        s = []
        s.append(big_prizes(lot,all_prizes[:5]))
        s.append(next_to_first(lot,all_prizes[5]))
        s.append(digit_prizes (lot,all_prizes[6:]))
        return(sum(s))

6631103921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 498, 'const': 636, 'code+const': 1134}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        if lot in prize[:-1]:
          return prize[-1] * prize[:-1].count(lot)
        return 0
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for prize in prizes:
          money += prize_check(lot, prize)
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        for number in prize[:-1]:
          before = str(int(number) - 1).zfill(6)
          after = str(int(number) + 1).zfill(6)
          if lot == before or lot == after:
            money += prize[-1]
        return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for number in prize[:-1]:
          if lot[:3] == number:
            money += prize[-1]
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        money = 0
        for number in prize[:-1]:
          if lot[-1:-4:-1][::-1] == number:
            money += prize[-1]
          if lot[-1:-3:-1][::-1] == number:
            money += prize[-1]
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6631111921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 536, 'const': 880, 'code+const': 1416}
def prize_check (lot,prize):
    total_each_prize = 0
    for i in range(len(prize)-1) :
        if lot == prize[i] :
            x = prize[-1]
        else :
            x = 0
        total_each_prize += x
    return total_each_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    total_big_prizes = 0
    for i in range(5) :
        total_big_prizes += prize_check(lot,prizes[i])
    return total_big_prizes
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    total_next_to_prize = 0
    if prize[0] == '000000' :
        near1 = '000001'
        near2 = '999999'
    elif prize[0] == '999999' :
        near1 = '000000'
        near2 = '999998'
    else :
        near1 = str(int(prize[0]) + 1)
        near2 = str(int(prize[0]) - 1)
    if lot == near1 or lot == near2 :
        total_next_to_prize += prize[-1]
    return total_next_to_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    total_first_digits_prize = 0
    first3 = lot[:3]
    total_first_digits_prize += prize_check(first3,prize)
    return total_first_digits_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    total_last_digits_prize = 0
    last3 = lot[3:]
    last2 = lot[4:]
    total_last_digits_prize += prize_check(last2,prize)
    total_last_digits_prize += prize_check(last3,prize)
    return total_last_digits_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    total_digit_prize = 0
    total_digit_prize += first_digits_check(lot,prizes[-3])
    total_digit_prize += last_digits_check(lot,prizes[-2])
    total_digit_prize += last_digits_check(lot,prizes[-1])
    return total_digit_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    total_prize = 0
    total_prize += big_prizes(lot,all_prizes[:5])
    total_prize += next_to_first(lot,all_prizes[5])
    total_prize += digit_prizes(lot,all_prizes[6:])
    return total_prize
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631120521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 504, 'const': 688, 'code+const': 1192}
def prize_check (lot,prize):
  tprize = 0
  for i in prize[:-1]:
    if lot == i:
      tprize += prize[-1]
  return tprize
def big_prizes (lot,prizes):
  tprize = 0
  for prizelist in prizes:
    tprize += prize_check (lot,prizelist)
  return tprize
def next_to_first (lot,prize):
  tprize = 0
  next_lower = int(prize[0]) - 1
  next_higher = int(prize[0]) + 1
  if int(lot) == next_lower or      int(lot) == next_higher:
      tprize += prize[-1]
  return tprize
def first_digits_check (lot,prize):
  tprize = 0
  for number in prize[:-1]:
    if lot[:3] == number:
      tprize += prize[-1]
  return tprize
def last_digits_check (lot,prize):
  tprize = 0
  for number in prize[:-1]:
    if len(number) == 3:
      if lot[-3:] == number:
        tprize += prize[-1]
    if len(number) == 2:
      if lot[-2:] == number:
        tprize += prize[-1]
    else:
      pass
  return tprize
def digit_prizes (lot,prizes):
  tprize = 0
  tprize = first_digits_check(lot,prizes[0]) +            last_digits_check(lot,prizes[1]) +            last_digits_check(lot,prizes[2])
  return tprize
def total_prize (lot,all_prizes):
  tprize = 0
  tprize = big_prizes(lot,all_prizes[:5]) +            digit_prizes (lot,all_prizes[6:]) +            next_to_first(lot,all_prizes[5])
  return tprize

6631124021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 424, 'const': 610, 'code+const': 1034}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  prize_money = 0
  for p in prize[:-1]:
    if lot == p:
        prize_money += prize[-1]
    else :
        prize_money += 0
  return prize_money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  sum_money = 0
  for i in range(5):
        sum_money += prize_check(lot, prizes[i])
  return sum_money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  prize1 = int(prize[0])
  if prize1 == 999999:
      upper_prize1 = "000000"
  else :
      upper_prize1 = str(prize1 + 1)
  if prize1 == 0:
      lower_prize1 = "999999"
  else :
      lower_prize1 = str(prize1 - 1)
  if lot in (upper_prize1, lower_prize1):
      prize_money = prize[1]
  else :
      prize_money = 0
  return prize_money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  sum_money = prize_check(lot[:3], prize)
  return sum_money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  sum_money = prize_check(lot[-len(prize[0]):], prize)
  return sum_money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
 return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
  return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6631135021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 824, 'code+const': 1418}
def prize_check (lot,prize):
  a = 0
  for b in prize[:-1]:     # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    if lot == b:           # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
      a += int(prize[-1])  # คืนผลรวมของเงินรางวัลที่ได้
  return a
def big_prizes (lot,prizes):
  a = 0                           # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  for prize in prizes:            # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    a += prize_check (lot,prize)  # คืนผลรวมของเงินรางวัลที่ได้
  return a
def next_to_first (lot,prize):
  a = 0            # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
  next_to = []     # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
  first,p = prize  # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
  if first == '000000':
    next_to += ['999999','000001']
  elif first == '999999':
    next_to += ['999998','000000']
  else:
    next_to += [str(int(first)-1), str(int(first)+1)]
  for b in next_to:
    if lot == b:
      a += p
  return a
def first_digits_check(lot,prize):
   a = 0                 # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
   for b in prize[:-1]:  # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
     if lot[:3] == b:    # คืนผลรวมของเงินรางวัลที่ได้
       a += prize[-1]
   return a
def last_digits_check(lot,prize):
     a = 0                  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
     for b in prize[:-1]:   # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
       if len(b) == 3:      # คืนผลรวมของเงินรางวัลที่ได้
         if lot[-3:] == b:  # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
           a += prize[-1]
       elif len(b) == 2:
         if lot[-2:] == b:
           a += prize[-1]
       else:
         pass
     return a
def digit_prizes (lot,prizes):
     a = 0                            # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
     for i in range(len(prizes)):   # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
       if i == 0:                       # คืนผลรวมของเงินรางวัลที่ได้
         a += first_digits_check(lot,prizes[i])
       else:
         a += last_digits_check(lot,prizes[i])
     return a
def total_prize (lot,all_prizes):
     a = 0                                  # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
     a += big_prizes(lot,all_prizes[:5])    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
     a += next_to_first(lot,all_prizes[5])  # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
     a += digit_prizes (lot,all_prizes[6:])
     return a

6631221221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize0.0
[1860045]
bytecount: {'code': 1676, 'const': 1464, 'code+const': 3140}
def prize_check (lot,prize):
        a = 0
        if lot in prize[:-1]:
          for i in range(len(prize)-1):
            if lot == prize[i]:
              a += prize[-1]
        return a
def big_prizes (lot,prize):
  a = 0
  for i in range(5):
        if lot in prize[i][:-1]:
            for k in range(len(prize[i])-1):
              if lot == prize[i][k]:
                a += prize[i][-1]
  return a
def next_to_first (lot,prize):
        a = 0
        b = [0,0]
        if prize[0] == '999999':
          b[0] = '999998'
          b[1] = '000000'
        elif prize[0] == '000000':
          b[0] = '999999'
          b[1] = '000001'
        else:
          b[0] = int(prize[0]) - 1
          b[1] = int(prize[0]) + 1
        if int(lot) == int(b[0]) or int(lot) == int(b[1]):
            a += prize[-1]
        return a
def first_digits_check(lot,prize):
        a = 0
        if lot[0:3] in prize[:-1][0:3]:
          for i in range(len(prize)-1):
            if lot[0:3] == prize[i][0:3]:
              a += prize[-1]
        return a
def last_digits_check(lot,prize):
        a = 0
        if len(prize[0]) == 3:
          if lot[3:] in prize[:-1]:
            for i in range(len(prize)-1):
              if lot[3:] == prize[i]:
                a += prize[-1]
        elif len(prize[0]) == 2:
          if lot[4:] in prize[:-1]:
            for i in range(len(prize)):
              if lot[4:] == prize[i]:
                a += prize[-1]
        return a
def digit_prizes (lot,prize):
  a = 0
  for i in range(3):
       if len(prize[i][0]) == 3:
          if lot[3:] in prize[i][:-1]:
            for k in range(len(prize[i])-1):
              if lot[3:] == prize[i][k]:
                a += prize[i][-1]
          elif lot[0:3] in prize[i][:-1]:
           for k in range(len(prize)-1):
            if lot[0:3] == prize[i][k]:
              a += prize[i][-1]
       elif len(prize[i][0]) == 2:
          if lot[4:] in prize[i][:-1]:
            for k in range(len(prize[i])-1):
              if lot[4:] == prize[i][k]:
                a += prize[i][-1]
  return a
def total_prize (lot,prize):
        a = 0
        for i in range(len(prize)):
            if lot in prize[i][:-1]:
              for k in range(len(prize[i])-1):
                if lot == prize[i][k]:
                  a += prize[i][-1]
            elif prize[i][-1] == 100000:
                b = [0,0]
                if prize[i][0] == '999999':
                  b[0] = '999998'
                  b[1] = '000000'
                elif prize[i][0] == '000000':
                  b[0] = '999999'
                  b[1] = '000001'
                else:
                  b[0] = int(prize[i][0]) - 1
                  b[1] = int(prize[i][0]) + 1
                if int(lot) == int(b[0]) or int(lot) == int(b[1]):
                    a += prize[i][-1]
            elif len(prize[i][0]) == 3:
              if lot[3:] in prize[i][:-1]:
                for k in range(len(prize[i])-1):
                  if lot[3:] == prize[i][k]:
                    a += prize[i][-1]
              elif lot[0:3] in prize[i][:-1]:
                for k in range(len(prize)-1):
                  if lot[0:3] == prize[i][k]:
                    a += prize[i][-1]
            elif len(prize[i][0]) == 2:
              if lot[4:] in prize[i][:-1]:
                for k in range(len(prize[i])-1):
                  if lot[4:] == prize[i][k]:
                   a += prize[i][-1]
        return a

6631222921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 646, 'const': 408, 'code+const': 1054}
def prize_check (lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      prize_lot=x
  for x in prize:
    if type(x)==str:
      if x==lot:
        money+=prize_lot
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prize):
  money=0
  for x in prize:
    money+=prize_check(lot,x)
  return money
def next_to_first (lot,prize):
  for x in prize:
    if type(x)==str:
      (upper,lowwer)=(int(x)+1,int(x)-1)
    elif type(x)==int:
      prize_lot=x
  if lot==str(upper) or lot==str(lowwer) :
    return prize_lot
  else:
    return 0
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      prize_lot=x
  for x in prize:
    if type(x)==str:
      if x==lot[:3]:
        money+=prize_lot
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
  money=0
  for x in prize:
    if type(x)==int:
      prize_lot=x
  for x in prize:
    if type(x)==str:
      if x==lot[-len(x):]:
        money+=prize_lot
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
  money=0
  for y in prizes:
      for x in y:
        if type(x)==int:
          prize_lot=x
      for x in y:
        if type(x)==str:
          if x==lot[-len(x):]:
            money+=prize_lot
          elif x==lot[:len(x)]:
            money+=prize_lot
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
  money=0
  for x in all_prizes[:5]:
    money+=prize_check(lot,x)
  money+=next_to_first(lot,all_prizes[5])
  money+=digit_prizes(lot,all_prizes[6:])
  return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631227021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 824, 'code+const': 1418}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        a = 0
        for b in prize[:-1]:
          if lot ==b:
            a += int(prize[-1])
        return a
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        a = 0
        for prize in prizes:
          a += prize_check(lot,prize)
        return a
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        a = 0
        next_to = []
        first,p = prize
        if first == '000000':
          next_to += ['999999', '000001']
        elif first == '999999':
          next_to += ['999998', '000000']
        else:
          next_to += [str(int(first)-1), str(int(first)+1)]
        for b in next_to:
          if lot == b:
            a += p
        return a
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        a = 0
        for b in prize[:-1]:
          if lot[:3] == b:
            a += prize[-1]
        return a
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        a = 0
        for b in prize[:-1]:
          if len(b) ==3:
            if lot[-3:] == b:
              a += prize[-1]
          elif len(b) == 2:
            if lot[-2:] == b:
              a += prize[-1]
          else:
            pass
        return a
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        a = 0
        for i in range(len(prizes)):
          if i == 0:
            a += first_digits_check(lot,prizes[i])
          else:
            a += last_digits_check(lot,prizes[i])
        return a
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a = 0
        a += big_prizes(lot,all_prizes[:5])
        a += next_to_first(lot,all_prizes[5])
        a += digit_prizes(lot,all_prizes[6:])
        return a

6631457021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 592, 'const': 795, 'code+const': 1387}
def prize_check (lot,prize):
    money = 0
    out = 0
    for i in prize:
        if type(i) == int:
            money = i
    for i in prize:
        if lot == i:
            out += money
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    out = 0
    for i in prizes:
        out += prize_check (lot,i)
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    out = 0
    money = 0
    jackpot = prize[0]
    next1 = ''
    next2 = ''
    for i in prize:
        if type(i) == int:
            money = i
    if jackpot == '999999':
        next1 = '999998'
        next2 = '000000'
    elif jackpot == '000000':
        next1 = '999999'
        next2 = '000001'
    else:
        next1 = str(int(jackpot) - 1)
        next2 = str(int(jackpot) + 1)
    if lot == next1 or lot == next2:
            out += money
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    lot = lot[:3]
    return prize_check(lot,prize)
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    if len(prize[0]) == 2:
        lot = lot[4:]
    elif len(prize[0]) == 3:
        lot = lot[3:]
    out = 0
    money = 0
    for i in prize:
        if type(i) == int:
            money = i
    for i in prize:
        if lot == i:
            out += money
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    out = 0
    out += first_digits_check(lot,prizes[0])
    out += last_digits_check(lot,prizes[1])
    out += last_digits_check(lot,prizes[2])
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    out = 0
    out += big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])
    return out
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631465021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0TypeError('can only concatenate str (not "int") to str')
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1154, 'const': 687, 'code+const': 1841}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        j = 0
        a = 0
        for i in prize[0:len(prize)-1]:
          if i == lot:
            a = a + prize[len(prize)-1]
        return(a)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        i = 0
        b = 0
        while i < len(prizes):
          a = prizes[i]
          for j in a[0:len(a)-1]:
            if j == lot:
              b = b + a[len(a)-1]
          i = i+1
        return(b)
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        a = prize[0]
        b = int(a)
        c = b+1
        d = b-1
        e = 0
        bb = str(a)
        cc = str(c)
        dd = str(d)
        cc = [str(ccc) for ccc in cc]
        dd = [str(ddd) for ddd in dd]
        if d < 0:
          dd.clear()
          while len(dd) < len(bb):
            dd.insert(0,9)
        while len(cc) < len(bb):
          cc.insert(0,0)
        while len(cc) > len(bb):
          cc.pop(0)
        while len(dd) < len(bb):
          dd.insert(0,0)
        while len(dd) < len(bb):
          dd.pop(0)
        x = ''
        y = ''
        i=0
        j=0
        while i < len(cc):
          x = x + cc[i]
          i = i+1
        while j < len(dd):
          y = y + dd[j]
          j = j+1
        if lot == x or lot == y:
          e = e + prize[len(prize)-1]
        return(e)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        i = 0
        b = 0
        while i < len(prize)-1:
          a = prize[i]
          if lot[0:3] == a[0:3]:
            b = b + prize[len(prize)-1]
          i = i+1
        return(b)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        i = 0
        b = 0
        while i < len(prize)-1:
          a = prize[i]
          if lot[len(lot)-2:len(lot)] == a[len(a)-2:len(a)] or lot[len(lot)-3:len(lot)] == a[len(a)-3:len(a)]:
            b = b + prize[len(prize)-1]
          i = i+1
        return(b)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        a = first_digits_check(lot,prizes[0])
        b = last_digits_check(lot,prizes[1])
        c = last_digits_check(lot,prizes[2])
        d = a+b+c
        return(d)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a = big_prizes(lot,all_prizes[:5])
        b = next_to_first(lot,all_prizes[5])
        c = digit_prizes(lot,all_prizes[6:])
        d = a+b+c
        return(d)

6631470121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 488, 'const': 688, 'code+const': 1176}
def prize_check(lot,prize):
    m = 0
    for i in range(len(prize)):
        if lot == prize[i]:
            m += prize[-1]
    return m
def big_prizes(lot,prizes):
    m = 0
    for i in prizes:
        m += prize_check(lot,i)
    return m
def next_to_first(lot,prize):
    t = [int(e) for e in prize]
    g = [str(t[0]+ 1), str(t[0] - 1)]
    m = 0
    for a in g:
        if lot == a:
            m += prize[-1]
    return m
def first_digits_check(lot,prize):
    m = 0
    for c in prize:
        if lot[0:3] == c:
            m += prize[-1]
    return m
def last_digits_check(lot,prize):
    m = 0
    for k in prize:
        if lot[3:6] == k:
            m += prize[-1]
    if lot[4:6] == prize[0]:
        m += prize[-1]
    return m
def digit_prizes(lot,prizes):
    m = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) +          last_digits_check(lot,prizes[2])
    return m
def total_prize(lot,all_prizes):
    m = big_prizes(lot,all_prizes[0:5]) + next_to_first(lot,all_prizes[5]) +          digit_prizes(lot,all_prizes[6:9])
    return m

6631501021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 516, 'const': 664, 'code+const': 1180}
def prize_check (lot,prize):
    a = 0
    for i in prize[:-1]:
        if lot == i:
            a += prize[-1]
    return a
def big_prizes (lot,prizes):
    a1 = 0
    for i in prizes:
        for b in i[:-1]:
            if lot == b:
                a1 += i[-1]
    return a1
def next_to_first (lot,prize):
    a2 = 0
    for i in prize[:-1]:
        if int(lot) == int(i)+1 or int(lot) == int(i)-1:
            a2 += prize[-1]
    return a2
def first_digits_check(lot,prize):
    a3 = 0
    for i in prize[:-1]:
        if lot[:-3] == i:
            a3 += prize[-1]
    return a3
def last_digits_check(lot,prize):
    sum = 0
    if len(prize[0]) == 3:
        check = lot[-3:]
    else:
        check = lot[-2:]
    for n in prize[:-1]:
        if check == n:
            sum += prize[-1]
    return sum
def digit_prizes (lot,prizes):
    x1 = first_digits_check(lot,prizes[0])
    x2 = last_digits_check(lot,prizes[1])
    x3 = last_digits_check(lot,prizes[2])
    return x1+x2+x3
def total_prize (lot,all_prizes):
    a6 = (prize_check(lot,all_prizes))+(big_prizes(lot,all_prizes[:5]))           +(next_to_first(lot,all_prizes[5]))+(digit_prizes (lot,all_prizes[6:]))
    return a6

6631503221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 664, 'code+const': 1258}
def prize_check (lot,prize):
    sum = 0
    for i in prize:
        if lot == i:
            sum += prize[-1]
    return sum
def big_prizes (lot,prizes):
    sum = 0
    for i in prizes:
        for k in i:
            if lot == k:
                sum += i[-1]
    return sum
def next_to_first (lot,prize):
    sum = 0
    x = prize[0]
    y = int(x)
    y1 = str(y+1)
    y2 = str(y-1)
    if lot in y1:
        sum += prize[-1]
    elif lot in y2:
        sum += prize[-1]
    return sum
def first_digits_check(lot,prize):
    sum = 0
    for i in prize:
        if lot[0:3] == i:
            sum += prize[-1]
    return sum
def last_digits_check(lot,prize):
    sum = 0
    for i in prize:
        if lot[3:] == i:
            sum += prize[-1]
        elif lot[4:] == i:
            sum += prize[-1]
    return sum
def digit_prizes (lot,prizes):
    sum = 0
    for i in prizes:
        for a in i:
            if lot[0:3] == a:
                sum += i[-1]
            elif lot[3:] == a:
                sum += i[-1]
            elif lot[4:] == a:
                sum += i[-1]
    return sum
def total_prize (lot,all_prizes):
    a = prize_check(lot,all_prizes)
    b = big_prizes(lot,all_prizes[:5])
    c = next_to_first(lot,all_prizes[5])
    d = first_digits_check(lot,all_prizes)
    e = last_digits_check(lot,all_prizes)
    f = digit_prizes(lot,all_prizes[6:])
    return a+b+c+d+e+f

6631505521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 702, 'const': 622, 'code+const': 1324}
def prize_check(lot, prize):
  prizeMoney = 0
  for i in prize:
    if lot == i and isinstance(i, str):
      for j in prize:
        if isinstance(j, int):
          prizeMoney += j
  return prizeMoney
def big_prizes(lot, prizes):
  prizeMoney = 0
  for i in range(0, len(prizes)):
    for j in prizes[i]:
      if j == lot and isinstance(lot, str):
        for k in prizes[i]:
          if isinstance(k, int):
            prizeMoney += k
  return prizeMoney
def next_to_first(lot, prize):
  prizeMoney = 0
  for i in prize:
    if (int(i) - 1 == int(lot) or int(i) + 1 == int(lot)) and isinstance(
        i, str):
      for j in prize:
        if isinstance(j, int):
          prizeMoney += j
  return prizeMoney
def first_digits_check(lot, prize):
  prizeMoney = 0
  lotString = ""
  for i in range(0, len(lot) - 3):
    lotString += lot[i]
  for i in prize:
    if lotString == i and isinstance(i, str):
      for j in prize:
        if isinstance(j, int):
          prizeMoney += j
  return prizeMoney
def last_digits_check(lot, prize):
  prizeMoney = 0
  lotStringThree = ""
  lotStringTwo = ""
  for i in range(3, len(lot)):
    lotStringThree += lot[i]
  for i in range(4, len(lot)):
    lotStringTwo += lot[i]
  for i in prize:
    if (lotStringThree == i or lotStringTwo == i) and isinstance(i, str):
      for j in prize:
        if isinstance(j, int):
          prizeMoney += j
  return prizeMoney
def digit_prizes(lot, prizes):
  prizeMoney = first_digits_check(lot, prizes[0]) + last_digits_check(
      lot, prizes[1]) + last_digits_check(lot, prizes[2])
  return prizeMoney
def total_prize(lot, all_prizes):
  prizeMoney = 0
  for i in range(0, len(all_prizes)):
    prizeMoney += prize_check(lot, all_prizes[i])
  prizeMoney += next_to_first(lot, all_prizes[5]) + digit_prizes(
      lot, all_prizes[6:])
  return prizeMoney

6631506121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 560, 'const': 748, 'code+const': 1308}
def prize_check (lot,prize):
    sum1 = 0
    for i in prize[:-1]:
        if i == lot:
            sum1 += prize[-1]
    return sum1
def big_prizes (lot,prizes):
    sum2 = 0
    for e in prizes:
        sum2 += prize_check(lot,e)
    return sum2
def next_to_first (lot,prize):
    sum3 = 0
    if int(prize[0])+1 == int(lot) or int(prize[0])-1 == int(lot):
        sum3 += int(prize[-1])
    return sum3
def first_digits_check(lot,prize):
    sum4 = 0
    for g in prize[:-1]:
        if g == lot[0:3]:
            sum4 += prize[-1]
    return sum4
def last_digits_check(lot,prize):
    sum5 = 0
    if len(prize[0]) == 3:
        check = lot[-3:]
    else:
        check = lot[-2:]
    for n in prize[:-1]:
        if check == n:
            sum5 += prize[-1]
    return sum5
def digit_prizes (lot,prizes):
    sum6 = 0
    for h in prizes:
        for d in h[:-1]:
            if len(d) == 2 and d in lot[-2:7]:
                sum6 += h[-1]
            elif len(d) == 3 and (d in lot[-3:7] or d in lot[0:3]):
                sum6 += h[-1]
    return sum6
def total_prize (lot,all_prizes):
    a1 = big_prizes(lot,all_prizes[:5])
    a2 = digit_prizes(lot,all_prizes[6:])
    a3 = next_to_first(lot,all_prizes[5])
    return a1+a2+a3

6631511221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 810, 'const': 828, 'code+const': 1638}
def prize_check (lot,prize):
        p = 0
        for i in prize:
            if lot == i:
                p += prize[-1]
        return p
def big_prizes (lot,prizes):
        p = 0
        for i in prizes:
          n = [x for x in i if x==lot]
          p += len(n)*i[-1]
        return p
def next_to_first (lot,prize):
        p = 0
        n = [x for x in prize if str(int(x)-1)==lot or str(int(x)+1)==lot]
        p += len(n)*prize[-1]
        return p
def first_digits_check(lot,prize):
        lot = lot[:3]
        p = 0
        n = [x for x in prize if x==lot]
        p += len(n)*prize[-1]
        return p
def last_digits_check(lot,prize):
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        p = 0
        n = [x for x in prize if x==lot3 or x==lot2]
        p += len(n)*prize[-1]
        return p
def digit_prizes (lot,prizes):
        p=0
        lot3_f = lot[:3]
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        for i in prizes:
          n = [x for x in i if x==lot2 or x==lot3 or x==lot3_f]
          p += len(n)*i[-1]
        return p
def total_prize (lot,all_prizes):
        all_prizes[5] = [str(int(all_prizes[5][0])-1),str(int(all_prizes[5][0])+1),all_prizes[5][1]]
        p=0
        lot3_f = lot[:3]
        lot3 = lot[-3:]
        lot2 = lot[-2:]
        for i in all_prizes:
          n = [x for x in i if x==lot or x==lot2 or x==lot3 or x==lot3_f]
          p += len(n)*i[-1]
        return p

6631512921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 594, 'const': 820, 'code+const': 1414}
def prize_check(lot, prize):
    total = 0
    for numbers in prize[:-1]:
        if lot in numbers:
            total += int(prize[-1])
    return total
def big_prizes(lot, prizes):
    total = 0
    for prize in prizes:
        total += prize_check(lot, prize)
    return total
def next_to_first(lot, prize):
    total = 0
    next_to = []
    first, money = prize
    if first == '99999':
        next_to += ['99998', '00000']
    elif first == '00000':
        next_to += ['99999', '00001']
    else:
        next_to += [str(int(first)-1), str(int(first)+1)]
    for numbers in next_to:
        if lot in numbers:
            total += money
    return total
def first_digits_check(lot, prize):
    total = 0
    for numbers in prize[:-1]:
        if lot[:3] in numbers:
            total += prize[-1]
    return total
def last_digits_check(lot, prize):
    total = 0
    for numbers in prize[:-1]:
        if len(numbers) == 3:
            if lot[-3:] == numbers:
                total += prize[-1]
        elif len(numbers) == 2:
            if lot[-2:] == numbers:
                total += prize[-1]
        else:
            pass
    return total
def digit_prizes(lot, prizes):
    total = 0
    for i in range(len(prizes)):
        if i == 0:
            total += first_digits_check(lot,prizes[i])
        else:
            total += last_digits_check(lot,prizes[i])
    return total
def total_prize(lot, all_prizes):
    total = 0
    total += big_prizes(lot, all_prizes[:5])
    total += next_to_first(lot, all_prizes[5])
    total += digit_prizes(lot, all_prizes[6:])
    return total

6631514121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 544, 'const': 632, 'code+const': 1176}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        n = prize[:-1]
        v = prize[-1]
        sum = 0
        for l in n:
          if l == lot:
            sum += v
        return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for prize in prizes:
          sum += prize_check(lot,prize)
        return sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        n, v = prize
        if lot == str(int(n)+1): return v
        if lot == str(int(n)-1): return v
        return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        n = prize[:-1]
        v = prize[-1]
        sum = 0
        for l in n:
          if l == lot[:3]:
            sum += v
        return sum
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if len(prize[0]) == 3:
          n = prize[:-1]
          v = prize[-1]
          sum = 0
          for l in n:
            if l == lot[3:]:
              sum += v
          return sum
        if len(prize[0]) == 2:
          n, v = prize
          if n == lot[4:]:
              return v
        return 0
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        sum += first_digits_check(lot,prizes[0])
        sum += last_digits_check(lot,prizes[1])
        sum += last_digits_check(lot,prizes[2])
        return sum
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        sum = 0
        sum += big_prizes(lot,all_prizes[:5])
        sum += next_to_first(lot,all_prizes[5])
        sum += digit_prizes(lot,all_prizes[6:])
        return sum

6631518721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 968, 'const': 892, 'code+const': 1860}
def prize_check(lot, prize): #แยกรางวัลที่ 1-5
    count = prize[:-1].count(lot)
    return prize[-1] * count
def big_prizes(lot, prizes): #รวมรางวัลที่ 1-5
    total_prize = 0
    for prize in prizes:
      count = prize[:-1].count(lot)
      total_prize += prize[-1] * count
    return total_prize
def next_to_first(lot, prize): #ใกล้เคียงรางวัลที่ 1
    result = 0
    if (int(lot) == int(prize[0])-1): #ใกล้เคียงที่น้อยกว่าอยู่ 1
      result += prize[-1]
      return result
    elif (int(lot) == int(prize[0])+1): #ใกล้เคียงที่มากกว่าอยู่ 1
      result += prize[-1]
      return result
    else:
      return result
def first_digits_check(lot, prize): #เลขหน้า 3 ตัว
    count = prize.count(lot[:3])
    return prize[-1] * count
def last_digits_check(lot, prize): #เลขท้าย 3 ตัว และ 2 ตัว
    result = 0
    count_last_3digit  = prize.count(lot[3:])
    result += prize[-1] * count_last_3digit
    count_last_2digit  = prize.count(lot[4:])
    result += prize[-1] * count_last_2digit
    return result
def digit_prizes(lot, prizes): #ตรวจรางวัลเลขหน้าและเลขท้ายรวม
    total_prize = 0
    for prize in prizes:
      if prize == prizes[0]:
        count = prize.count(lot[:3]) # 3 ตัวหน้า
        total_prize += prize[-1] * count
      if prize == prizes[1]:
        count = prize.count(lot[3:]) # 3 ตัวท้าย
        total_prize += prize[-1] * count
      if prize == prizes[2]:
        count = prize.count(lot[4:]) # 2 ตัวท้าย
        total_prize += prize[-1] * count
    return total_prize
def total_prize(lot, all_prizes):
    total_prize = 0
    prizes = all_prizes
    for prize in prizes:
      if prize == prizes[0]:                 #รางวัลที่ 1
        count = prize[:-1].count(lot)
        total_prize += prize[-1] * count
      if prize == prizes[1]:                 #รางวัลที่ 2
        count = prize[:-1].count(lot)
        total_prize += prize[-1] * count
      if prize == prizes[2]:                 #รางวัลที่ 3
        count = prize[:-1].count(lot)
        total_prize += prize[-1] * count
      if prize == prizes[3]:                 #รางวัลที่ 4
        count = prize[:-1].count(lot)
        total_prize += prize[-1] * count
      if prize == prizes[4]:                 #รางวัลที่ 5
        count = prize[:-1].count(lot)
        total_prize += prize[-1] * count
      if prize == prizes[5]:                 #ใกล้เคียงที่ 1
        if (int(lot) == int(prize[0])-1):
          total_prize += prize[-1]
        elif (int(lot) == int(prize[0])+1):
          total_prize += prize[-1]
      if prize == prizes[6]:                #เลขหน้า 3 ตัว
        count = prize.count(lot[:3])
        total_prize += prize[-1] * count
      if prize == prizes[7]:                #เลขท้าย 3 ตัว
        count = prize.count(lot[3:])
        total_prize += prize[-1] * count
      if prize == prizes[8]:                #เลขท้าย 2 ตัว
        count = prize.count(lot[4:])
        total_prize += prize[-1] * count
    return total_prize

6631519321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 602, 'const': 692, 'code+const': 1294}
def prize_check (lot,prize):
    s1= 0
    for i in prize:
        if lot == i :
            s1 += prize[-1]
    return s1
def big_prizes (lot,prizes):
    s2 = 0
    for i in prizes:
        for e in i[:-1]:
            if lot == e:
                s2 += i[-1]
    return s2
def next_to_first (lot,prizes):
    s3 = 0
    x = prizes[0]
    y = int(x)
    y1 = str(y+1)
    y2 = str(y-1)
    if lot in y1 :
        s3 += prizes[-1]
    elif lot in y2:
        s3 += prizes[-1]
    return s3
def first_digits_check(lot,prize):
    s4 = 0
    for i in prize :
        if lot[:3] == i:
            s4 += prize[-1]
    return s4
def last_digits_check(lot,prize):
    s5 = 0
    for i in prize :
        if lot[-3:] == i:
            s5 += prize[-1]
        elif lot[-2:] == i:
            s5 += prize[-1]
    return s5
def digit_prizes (lot,prizes):
    s6 = 0
    for i in prizes :
        for k in i:
            if lot[-3:] == k:
                s6 += i[-1]
            elif lot[-2:] == k:
                s6 += i[-1]
            elif lot[:3] == k:
                s6 += i [-1]
    return s6
def total_prize (lot,all_prizes):
    a = prize_check(lot,all_prizes)
    b = big_prizes(lot,all_prizes[:5])
    c = next_to_first (lot,all_prizes[5])
    d = first_digits_check(lot,all_prizes)
    e = last_digits_check(lot,all_prizes)
    f = digit_prizes (lot,all_prizes[6:])
    return a+b+c+d+e+f

6631521521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 566, 'const': 688, 'code+const': 1254}
def prize_check(lot,prize) :
  r = 0
  for i in prize[:-1] :
    if lot == i :
      r += prize[-1]
  return r
def big_prizes(lot,prizes) :
  rt = 0
  for i in prizes[0:] :
    rt += prize_check(lot,i)
  return rt
def next_to_first(lot,prize) :
  r = 0
  left = int(prize[0])-1
  right = int(prize[0])+1
  if int(lot) == left or int(lot) == right:
    r += prize[-1]
  return r
def first_digits_check(lot,prize) :
  r = 0
  lot = int(lot[:3])
  for i in prize[:-1] :
    if lot == int(i) :
      r += prize[-1]
  return r
def last_digits_check(lot,prize) :
  r = 0
  if len(prize[0]) == 2 :
    for i in prize[:-1] :
      if int(lot[-2:]) == int(i) :
        r += prize[-1]
  elif len(prize[0]) == 3 :
    for i in prize[:-1] :
      if int(lot[-3:]) == int(i) :
        r += prize[-1]
  return r
def digit_prizes (lot,prizes) :
  r = 0
  r = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
  return r
def total_prize (lot,all_prizes) :
  r = 0
  r = big_prizes(lot,all_prizes[:5]) + digit_prizes (lot,all_prizes[6:]) + next_to_first(lot,all_prizes[5])
  return r

6631522121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 544, 'const': 608, 'code+const': 1152}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        lot_numbers = prize[:-1]
        prize_value = prize[-1]
        total = 0
        for num in lot_numbers:
          if num == lot:
            total += prize_value
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for prize in prizes:
          total += prize_check(lot,prize)
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        next_to_lot_1 = str(int(prize[0])+1)
        next_to_lot_2 = str(int(prize[0])-1)
        prize_value = prize[1]
        if lot == next_to_lot_1 or lot == next_to_lot_2:
          return prize_value
        else:
          return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        lot_numbers = prize[:-1]
        prize_value = prize[-1]
        lot_first3 = lot[:3]
        total = 0
        for num in lot_numbers:
          if num == lot_first3:
            total += prize_value
        return total
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if len(prize[0]) == 3:
          lot_numbers = prize[:-1]
          prize_value = prize[-1]
          lot_last3 = lot[3:]
          total = 0
          for num in lot_numbers:
            if num == lot_last3:
              total += prize_value
          return total
        else:
          lot_number = prize[0]
          prize_value = prize[1]
          lot_last2 = lot[4:]
          if lot_number == lot_last2:
            return prize_value
          else:
            return 0
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        total = first_digits_check(lot,prizes[0])
        total += last_digits_check(lot,prizes[1])
        total += last_digits_check(lot,prizes[2])
        return total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        total = big_prizes(lot,all_prizes[:5])
        total += next_to_first(lot,all_prizes[5])
        total += digit_prizes(lot,all_prizes[6:])
        return total

6631524421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 578, 'const': 800, 'code+const': 1378}
def prize_check (lot,prize):
  win = 0
  for z in prize[0:-1:1]:
    if lot == z:
      win = win + prize[-1]
  return win
def big_prizes (lot,prizes):
  win_B = 0
  for y in prizes[0:]:
    win_B = win_B + prize_check(lot,y)
  return win_B
def next_to_first (lot,prize):
  win = 0
  A = int(prize[0]) + 1
  B = int(prize[0]) - 1
  if int(lot) == A or int(lot) == B:
    win = win + prize [-1]
  return win
def first_digits_check(lot,prize):
  win = 0
  lot = int(lot[0:3:1])
  for x in prize [0:-1:1]:
    if lot == int(x) :
      win = win + prize[-1]
  return win
def last_digits_check(lot,prize):
  win = 0
  if len(prize[0]) == 2:
    for w in prize[0:-1:1]:
      if int(lot[-2::]) == int(w):
        win = win + prize[-1]
  elif len(prize[0]) == 3:
    for w in prize [0:-1:1]:
      if int(lot[-3::]) == int(w) :
        win = win+prize[-1]
  return win
def digit_prizes (lot,prizes):
  win = 0
  win =first_digits_check(lot,prizes[0]) +last_digits_check(lot,prizes[1]) +last_digits_check(lot,prizes[2])
  return win
def total_prize (lot,all_prizes):
  win = 0
  win = big_prizes(lot,all_prizes[0:5:1]) + digit_prizes (lot,all_prizes[6:]) + next_to_first(lot,all_prizes[5])
  return win

6631525021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 566, 'const': 688, 'code+const': 1254}
def prize_check (lot,prize):
        win1 = 0
        for i in prize[:-1]:
         if lot == i:
            win1+=prize[-1]
        return win1
def big_prizes (lot,prizes):
        win2 = 0
        for e in prizes[0:]:
         win2+=prize_check(lot,e)
        return win2
def next_to_first (lot,prize):
        win3 = 0
        Minus_One = int(prize[0])-1
        Plus_One = int(prize[0])+1
        if int(lot) == Minus_One or int(lot) == Plus_One:
          win3+=prize[-1]
        return win3
def first_digits_check(lot,prize):
        win4 = 0
        lot = int(lot[:3])
        for i in prize[:-1]:
           if lot == int(i):
            win4+=prize[-1]
        return win4
def last_digits_check(lot,prize):
        win5 = 0
        if len(prize[0]) == 2:
         for i in prize[:-1]:
            if int(lot[-2:]) == int(i):
              win5+=prize[-1]
        elif len(prize[0]) == 3:
         for i in prize[:-1]:
            if int(lot[-3:]) == int(i):
             win5+=prize[-1]
        return win5
def digit_prizes (lot,prizes):
        win6 = 0
        win6 = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
        return win6
def total_prize (lot,all_prizes):
        win7 = 0
        win7 = big_prizes(lot,all_prizes[:5]) + digit_prizes (lot,all_prizes[6:]) + next_to_first(lot,all_prizes[5])
        return win7

6631528021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 566, 'const': 688, 'code+const': 1254}
def prize_check(lot,prize):
  winnings = 0
  for i in prize[:-1]:
    if lot == i:
      winnings+=prize[-1]
  return winnings
def big_prizes(lot,prizes):
  winningsAll = 0
  for e in prizes[0:]:
    winningsAll+=prize_check(lot,e)
  return winningsAll
def next_to_first(lot,prize):
  winnings = 0
  Less = int(prize[0])-1
  More = int(prize[0])+1
  if int(lot) == Less or int(lot) == More:
    winnings+=prize[-1]
  return winnings
def first_digits_check(lot,prize):
  winnings = 0
  lot = int(lot[:3])
  for i in prize[:-1]:
    if lot == int(i):
      winnings+=prize[-1]
  return winnings
def last_digits_check(lot,prize):
  winnings = 0
  if len(prize[0]) == 2:
    for i in prize[:-1]:
      if int(lot[-2:]) == int(i):
        winnings+=prize[-1]
  elif len(prize[0]) == 3:
    for i in prize[:-1]:
      if int(lot[-3:]) == int(i):
        winnings+=prize[-1]
  return winnings
def digit_prizes (lot,prizes):
  winnings = 0
  winnings = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
  return winnings
def total_prize (lot,all_prizes):
  winnings = 0
  winnings = big_prizes(lot,all_prizes[:5]) + digit_prizes (lot,all_prizes[6:]) + next_to_first(lot,all_prizes[5])
  return winnings
#all_prizes = [['555556', 6000000],['111111', '222222', 200000],['333333', '444444', '666666', 80000],['555555', '555555', '777777', '888888', 40000],['000001', '000002', '000003', '000004', '000005', '000006', 20000],  # ['555556', 100000],['555', '666', 4000],['777', '888', 4000],['55', 2000]]
#lot = '555555'
#print(prize_check(lot,all_prizes[0]))
#print(prize_check(lot,all_prizes[3]))
#print(big_prizes(lot,all_prizes[:5]))
#print(next_to_first(lot,all_prizes[5]))
#print(first_digits_check(lot,all_prizes[6]))
#print(last_digits_check(lot,all_prizes[8]))
#print(digit_prizes (lot,all_prizes[6:]))
#print(total_prize (lot,all_prizes))

6631545621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 750, 'const': 748, 'code+const': 1498}
def prize_check (lot,prize):
    newprize = []
    for i in range(len(prize)-1):
        if lot == prize[i]:
            newprize.append(prize[-1])
    sum = 0
    for c in newprize:
        if type(c) == int:
            sum += c
    return sum
def big_prizes (lot,prizes):
    newprize = []
    for i in prizes:
        newprize.append(prize_check(lot, i))
    sum = 0
    for c in newprize:
         if type(c) == int:
            sum += c
    return sum
def next_to_first (lot,prize):
    newprize = []
    for i in range(len(prize)-1):
        if abs(int(lot) - int(prize[i])) == 1:
            newprize.append(prize[-1])
    sum = 0
    for c in newprize:
         if type(c) == int:
            sum += c
    return sum
def first_digits_check(lot,prize):
    newprize = []
    for i in range(len(prize)-1):
        if lot[:3] == prize[i][:3]:
            newprize.append(prize[-1])
    sum = 0
    for c in newprize:
         if type(c) == int:
            sum += c
    return sum
def last_digits_check(lot,prize):
    newprize = []
    for i in range(len(prize)-1):
        if lot[-3:] == prize[i][:3]:
            newprize.append(prize[-1])
        elif lot[-2:] == prize[i][:2]:
            newprize.append(prize[-1])
    sum = 0
    for c in newprize:
        if type(c) == int:
            sum += c
    return sum
def digit_prizes (lot,prizes):
    newprize = []
    newprize.append(first_digits_check(lot, prizes[0]))
    newprize.append(last_digits_check(lot, prizes[1]))
    newprize.append(last_digits_check(lot, prizes[2]))
    sum = 0
    for c in newprize:
        if type(c) == int:
            sum += c
    return sum
def total_prize (lot,all_prizes):
    return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6631549121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 566, 'const': 688, 'code+const': 1254}
def prize_check(lot,prize):
  took = 0
  for x in prize[:-1]:
    if lot == x:
      took+=prize[-1]
  return took
def big_prizes(lot,prizes):
  tooklai = 0
  for e in prizes[0:]:
    tooklai+=prize_check(lot,e)
  return tooklai
def next_to_first(lot,prize):
  took = 0
  Less = int(prize[0])-1
  More = int(prize[0])+1
  if int(lot) == Less or int(lot) == More:
    took+=prize[-1]
  return took
def first_digits_check(lot,prize):
  took = 0
  lot = int(lot[:3])
  for x in prize[:-1]:
    if lot == int(x):
     took+=prize[-1]
  return took
def last_digits_check(lot,prize):
  took = 0
  if len(prize[0]) == 2:
    for x in prize[:-1]:
      if int(lot[-2:]) == int(x):
        took+=prize[-1]
  elif len(prize[0]) == 3:
    for x in prize[:-1]:
      if int(lot[-3:]) == int(x):
       took+=prize[-1]
  return took
def digit_prizes (lot,prizes):
  took = 0
  took = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
  return took
def total_prize (lot,all_prizes):
  took = 0
  took = big_prizes(lot,all_prizes[:5]) + digit_prizes (lot,all_prizes[6:]) + next_to_first(lot,all_prizes[5])
  return took

6632038021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 682, 'const': 996, 'code+const': 1678}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        n = 0
        for i in prize[-2::-1]:
          if i == lot:
            n += 1
        money = prize[-1]*n
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in range((len(prizes))):
          n = 0
          for j in prizes[i]:
            if j == lot:
              n += 1
          money += prizes[i][-1]*n
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if prize[0] == '000000':
          n = 0
          l = ['999999', '000001']
          for i in l:
            if i == lot:
              n += 1
          money = prize[-1]*n
          return money
        elif prize[0] == '999999':
          n = 0
          l = ['999998', '000000']
          for i in l:
            if i == lot:
              n += 1
          money = prize[-1]*n
          return money
        else:
          n = 0
          l = [str(int(prize[0])-1), str(int(prize[0])+1)]
          for i in l:
            if i == lot:
              n += 1
          money = prize[-1]*n
          return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        n = 0
        for i in prize[-2::-1]:
          if i == lot[:3]:
            n += 1
        money = prize[-1]*n
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        d = -len(prize[0])
        n = 0
        for i in prize[-2::-1]:
          if i == lot[d:]:
            n += 1
        money = prize[-1]*n
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        prize0 = prizes[0]
        prize1 = prizes[1]
        prize2 = prizes[2]
        money = first_digits_check(lot,prize0) + last_digits_check(lot,prize1) + last_digits_check(lot,prize2)
        return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        money = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
        return money

6632153421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 480, 'const': 604, 'code+const': 1084}
def prize_check (lot,prize):
    money = 0
    for i in prize[:-1]:
        if lot == i:
            money += prize[-1]
    return money
def big_prizes (lot,prizes):
    money = 0
    for i in prizes:
        m = prize_check(lot, i)
        money += m
    return money
def next_to_first (lot,prize):
    money = 0
    r = [str(int(prize[0])-1), str(int(prize[0])+1)]
    if lot in r:
        money += prize[-1]
    return money
def first_digits_check(lot,prize):
    money = 0
    for i in prize[:-1]:
        if lot[:3] == i:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
    money = 0
    for i in prize[:-1]:
        j = 0 - len(i)
        if lot[j:] == i:
            money += prize[-1]
    return money
def digit_prizes (lot,prizes):
    m = 0
    m += first_digits_check(lot,prizes[0])
    m += last_digits_check(lot,prizes[1])
    m += last_digits_check(lot,prizes[2])
    return m
def total_prize (lot,all_prizes):
    m = 0
    m += big_prizes(lot,all_prizes[:-5])
    m += next_to_first(lot,all_prizes[5])
    m += digit_prizes(lot,all_prizes[6:])
    return m

6632171721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1132, 'const': 1436, 'code+const': 2568}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prize)-1):
        if lot == prize[i]:
           money += prize[-1]
    return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prizes)):
        for k in range(len(prizes[i])-1):
           if lot == prizes[i][k]:
              money += prizes[i][-1]
    return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    money = 0
    if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1):
            money += prize[-1]
    elif prize[0] == '000000':
         if lot == "000001" or lot == "999999":
            money += prize[-1]
    elif prize[0] == '999999':
         if lot == "000000" or lot == "999998":
            money += prize[-1]
    return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prize) - 1):
        if lot[0:3] == prize[i][0:3]:
            money += prize[-1]
    return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    money = 0
    for i in range(len(prize) - 1):
        if lot[-3:] == prize[i] or lot[-2:] == prize[i] :
            money += prize[-1]
    return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    for i in range(len(prizes)):
        for k in range(len(prizes[i])-1):
            if lot[-3:] == prizes[i][k] or lot[-2:] == prizes[i][k] or lot[0:3] == prizes[i][k][0:3]:
               money += prizes[i][-1]
    return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    money = 0
    for i in range(len(all_prizes[:5])):
        for k in range(len(all_prizes[i]) - 1):
            if lot == all_prizes[i][k]:
                money += all_prizes[i][-1]
    for i in range(len(all_prizes[5]) - 1):
        if lot == str(int(all_prizes[5][i]) + 1) or lot == str(int(all_prizes[5][i]) - 1):
            money += all_prizes[5][-1]
        elif all_prizes[5][0] == "000000":
           if lot == "000001" or lot == "999999":
              money += all_prizes[5][-1]
        elif all_prizes[5][0] == '999999':
           if lot == "000000" or lot == "999998":
              money += all_prizes[5][-1]
    for i in range(len(all_prizes[6:])):
        for k in range(len(all_prizes[6:][i]) - 1):
            if lot[-3:] == all_prizes[6:][i][k] or lot[-2:] == all_prizes[6:][i][k] or lot[0:3] == all_prizes[6:][i][k][0:3]:
                money += all_prizes[6:][i][-1]
    return money

6632187821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 538, 'const': 804, 'code+const': 1342}
def prize_check (lot,prize):
  m = 0
  for i in range(len(prize)-1) :
    if lot == prize[i] :
      m += prize[-1]
  return m
def big_prizes (lot,prizes):
  m = 0
  for e in prizes :
    m += prize_check(lot,e)
  return m
def next_to_first (lot,prize):
  p = []
  if not(prize[0] == '999999' or prize[0] == '000000'):
    p.append(str(int(prize[0])-1)); p.append(str(int(prize[0])+1))
  elif prize[0] == '999999' :
    p.append('000000'); p.append('999998')
  elif prize[0] == '000000' :
    p.append('000001'); p.append('999999')
  p.append(prize[-1])
  return prize_check(lot,p)
def first_digits_check(lot,prize):
  return prize_check(lot[:3],prize)
def last_digits_check(lot,prize):
  if len(prize[0]) == 2 :
    return prize_check(lot[-2:],prize)
  elif len(prize[0]) == 3 :
    return prize_check(lot[-3:],prize)
def digit_prizes (lot,prizes):
  m = first_digits_check(lot,prizes[0])
  for e in prizes[1:] :
    m += last_digits_check(lot,e)
  return m
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6632199321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 680, 'const': 832, 'code+const': 1512}
def prize_check (lot,prize) :
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
  sum = 0
  for i in range(len(prize)- 1) :
    if lot == prize[i] :
      sum += prize[-1]
  return sum
def big_prizes(lot,prize) :
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
  list_sum = []
  for e in prize :
    for i in range(len(e)-1) :
      summ = 0
      if lot == e[i] :
        summ += e[-1]
        list_sum.append(summ)
  sumtotal1 = sum(list_sum)
  return sumtotal1
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    if abs(int(lot) - int(prize[0])) == 1 or abs(int(lot) - int(prize[0]) == 999999):
      return prize[1]
    else :
      return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
  sum = 0
  for i in range(len(prize)-1) :
    if lot[:3] == prize[i] :
      sum += prize[-1]
  return sum
def last_digits_check(lot,prize) :
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
  sum = 0
  for i in range(len(prize) - 1) :
    if lot[4:] == prize[i] or lot[3:] == prize[i] :
      sum += prize[-1]
  return sum
def digit_prizes (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
    sum = 0
    for i in range(len(prize[0]) - 1) :
      if prize[0][i] == lot[:3] :
        sum += prize[0][-1]
    for i in range(len(prize[1]) - 1):
      if prize[1][i] == lot[3:] :
        sum += prize[1][-1]
    for i in range(len(prize[2]) - 1):
      if prize[2][i] == lot[4:] :
        sum += prize[2][-1]
    return sum
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    sum_all = big_prizes(lot,all_prizes[:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
    return sum_all

6632210521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 0987, 0987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1056, 'const': 1176, 'code+const': 2232}
def prize_check(lot,prize):
    all_p = []
    for i in range(len(prize)-1):
        if lot == prize[i]:
            all_p.append(prize[-1])
    return sum(all_p)
def big_prizes(lot,prizes):
    all_p = []
    for i in range(5):
        for j in range(len(prizes[i])-1):
            if lot == prizes[i][j]:
                all_p.append(prizes[i][-1])
    return sum(all_p)
def next_to_first(lot,prize):
    if prize[0] == '999999':
        if lot == '999998' or lot == '000000':
            return prize[-1]
        else:
            return 0
    elif prize[0] == '000000':
        if lot == '999999' or lot == '000001':
            return prize[-1]
        else:
            return 0
    else:
        if lot == str(int(prize[0])+1) or lot == str(int(prize[0])-1):
            return prize[-1]
        else:
            return 0
def first_digits_check(lot,prize):
    all_p = []
    for i in range(len(prize)-1):
        if  lot[:3] == prize[i]:
            all_p.append(prize[-1])
    return sum(all_p)
def last_digits_check(lot,prize):
    all_p =[]
    if len(prize[0]) == 3:
        for i in range(len(prize)-1):
            if lot[3:] == prize[i]:
                all_p.append(prize[-1])
    if len(prize[0]) == 2:
        for i in range(len(prize)-1):
            if lot[4:] == prize[i]:
                all_p.append(prize[-1])
    return sum(all_p)
def digit_prizes(lot,prizes):
    all_p = []
    for i in range(len(prizes)):
        for j in range(len(prizes[i])-1):
            if i == 0 :
                if lot[:3] == prizes[i][j]:
                    all_p.append(prizes[i][-1])
            if i == 1 :
                if lot[3:] == prizes[i][j]:
                    all_p.append(prizes[i][-1])
            if i ==2 :
                if lot[4:] == prizes[i][j]:
                    all_p.append(prizes[i][-1])
    return sum(all_p)
def total_prize(lot,all_prizes):
    all_p = []
    for i in range(len(all_prizes)):
        for j in range(len(all_prizes[i])-1):
            if i < 5:
                if lot == all_prizes[i][j]:
                    all_p.append(all_prizes[i][-1])
            if i == 5:
                all_p.append(next_to_first(lot, all_prizes[i]))
            if i == 6 :
                if lot[:3] == all_prizes[i][j]:
                    all_p.append(all_prizes[i][-1])
            if i == 1 :
                if lot[3:] == all_prizes[i][j]:
                    all_p.append(all_prizes[i][-1])
            if i == 8 :
                if lot[4:] == all_prizes[i][j]:
                    all_p.append(all_prizes[i][-1])
    return sum(all_p)

6632217021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_20.0
[0, 987, 987, 987, 987, 0987, 0987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 798, 'const': 800, 'code+const': 1598}
def prize_check (lot,all_prizes):
        money = 0
        st_set = []
        st_set = all_prizes
        for i in range( len(all_prizes) - 1) :
          if st_set[i] == lot :
            money += st_set[-1]
        return(money)
def big_prizes (lot,all_prizes):
        st_to_fifth_set = []
        money = 0
        for i in range( len(all_prizes)) :
          st_to_fifth_set = all_prizes[i]
          for j in range( len(st_to_fifth_set) - 1) :
            if st_to_fifth_set[j] == lot :
              money += st_to_fifth_set[-1]
        return(money)
def next_to_first (lot,all_prizes):
        next_to_first_set = []
        money = 0
        next_to_first_set = all_prizes
        check_num = next_to_first_set[0]
        check_num_rigth = 0
        check_num_left = 0
        check_num_rigth = int(check_num) + 1
        check_num_left = int(check_num) - 1
        if int(lot) == check_num_rigth :
          money += all_prizes[-1]
        if int(lot) == check_num_left :
          money += all_prizes[-1]
        return(money)
def first_digits_check(lot,all_prizes):
        first_digits_three_digit_set = []
        first_digits_three_digit_lot = lot[:3]
        first_digits_three_digit_set = all_prizes
        money = 0
        for i in range( len(first_digits_three_digit_set) - 1) :
          if first_digits_three_digit_set[i] == first_digits_three_digit_lot :
            money += all_prizes[-1]
        return(money)
def last_digits_check(lot,all_prizes):
        last_digits_three_digit_set = []
        last_digits_two_digit_set = []
        money = 0
        digit_check_str = all_prizes[0]
        digit_check_lengh_str = len(digit_check_str)
        if digit_check_lengh_str == 2 :
          last_digits_two_digit_set = all_prizes
          last_digits_two_digit_lot = lot[4::1]
          for i in range( len(last_digits_two_digit_set) - 1 ) :
            if last_digits_two_digit_set[i] == last_digits_two_digit_lot :
              money += all_prizes[-1]
        if digit_check_lengh_str == 3 :
          last_digits_three_digit_set = all_prizes
          last_digits_three_digit_lot = lot[3::1]
          for i in range( len(last_digits_three_digit_set) - 1 ) :
            if last_digits_three_digit_set[i] == last_digits_three_digit_lot :
              money += all_prizes[-1]
        return(money)
def digit_prizes (lot,all_prizes):
        first_digit_prizes_money = 0
        last_two_digit_prizes_money = 0
        last_three_digit_prizes_money = 0
        first_digit_prizes_money = first_digits_check(lot,all_prizes[0])
        last_two_digit_prizes_money = last_digits_check(lot,all_prizes[1])
        last_three_digit_prizes_money = last_digits_check(lot,all_prizes[2])
        digit_prizes_money = first_digit_prizes_money + last_two_digit_prizes_money + last_three_digit_prizes_money
        return(digit_prizes_money)
def total_prize (lot,all_prizes):
    prize_check_money = []
    sub_prize_check_money_list = []
    total_prize_check_money_list = []
    total_prize_check_money = 0
    prize_check_money.append(big_prizes(lot,all_prizes[:5]))
    prize_check_money.append(next_to_first(lot,all_prizes[5]))
    prize_check_money.append(digit_prizes (lot,all_prizes[6:]))
    for f in range( len(prize_check_money)) :
      sub_prize_check_money_list = prize_check_money[f]
      total_prize_check_money_list.append(sub_prize_check_money_list)
    for j in range( len(total_prize_check_money_list)) :
      total_prize_check_money += total_prize_check_money_list[j]
    return(total_prize_check_money)

6331007021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 560, 'const': 576, 'code+const': 1136}
def prize_check (lot,prize):
        return sum([ prize[-1]  for p in prize[:-1] if lot == p ])
def big_prizes (lot,prizes):
        return sum([ prize_check(lot,p) for p in prizes])
def next_to_first (lot,prize):
        one_mil = 10**6
        return sum([ prize[-1]  for p in prize[:-1] if (int(lot)) in [(int(p)+1) % one_mil, (int(p)-1) % one_mil]])
def first_digits_check(lot,prize):
        return sum([ prize[-1] for p in prize[:-1] if lot[:3] == p])
def last_digits_check(lot,prize):
        return sum([ prize[-1] for p in prize[:-1] if lot[-(len(p)):] == p])
def digit_prizes (lot,prizes):
        return sum([first_digits_check(lot,prizes[0]), sum([last_digits_check(lot,p) for p in prizes[1:]])])
def total_prize (lot,all_prizes):
        big_prize = big_prizes(lot,all_prizes[:5])
        side_prize = next_to_first(lot,all_prizes[5])
        digit_prize = digit_prizes (lot,all_prizes[6:])
        return sum([big_prize,side_prize,digit_prize])

6531523721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 626, 'const': 936, 'code+const': 1562}
def prize_check (lot,prize):
    total = 0
    for e in prize:
        if lot == e:
            total += prize[-1]
        else:
            total+=0
    return total
def big_prizes(lot, all_prizes):
    total = 0
    for prize in all_prizes[:5]:
        for p in prize:
            if lot == p:
                total += int(prize[-1])
    return total
def next_to_first(lot, prize):
    total = 0
    if int(lot) + 1 == int(prize[0]) or int(lot) - 1 == int(prize[0]):
        total += int(prize[-1])
    elif prize[0] == '000000':
        if lot == '999999' or lot == '000001':
            total += int(prize[-1])
    elif prize[0] == '999999':
        if lot == '999998' or lot == '000000':
            total += int(prize[-1])
    return total
def first_digits_check(lot,prize):
    total = 0
    for p in prize[:-1]:
        if lot[0:3] == p:
            total += prize[-1]
    return total
def last_digits_check(lot,prize):
    total = 0
    for p in prize[:-1]:
        if lot[3:] == p or lot[4:] == p:
            total += prize[-1]
    return total
def digit_prizes(lot, prizes):
    total = 0
    for p in prizes:
        for e in p[:-1]:
            if lot[:3] == e or lot[3:] == e or lot[4:] == e:
                total += p[-1]
    return total
def total_prize(lot, all_prizes):
    total = 0
    total += big_prizes(lot, all_prizes)
    total += next_to_first(lot, all_prizes[5])
    total += digit_prizes(lot, all_prizes[6:])
    return total

6630001321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 510, 'const': 692, 'code+const': 1202}
def prize_check (lot,prize):
        sum = 0
        for i in range(len(prize)-1) :
            if lot == prize[i] : sum += prize[-1]
        return sum
def big_prizes (lot,prizes):
        sum = 0
        for e in prizes :
            sum += prize_check(lot,e)
        return sum
def next_to_first (lot,prize):
        sum = 0
        next1 = int(prize[0]) - 1
        next2 = int(prize[0]) + 1
        if next1 < 0 : next1 = 999999
        if next2 > 999999 : next2 = 0
        if int(lot) == next1 : sum += prize[-1]
        if int(lot) == next2 : sum += prize[-1]
        return sum
def first_digits_check(lot,prize):
        return prize_check(lot[:3:],prize)
def last_digits_check(lot,prize):
        if len(prize[0]) == 3 : return prize_check(lot[-3::1],prize)
        if len(prize[0]) == 2 : return prize_check(lot[-2::1],prize)
def digit_prizes (lot,prizes):
        sum = 0
        sum += first_digits_check(lot,prizes[0]) #checkfirstdigit
        sum += last_digits_check(lot,prizes[1]) #check3lastdigit
        sum += last_digits_check(lot,prizes[2]) #check2lastdigit
        return sum
def total_prize (lot,all_prizes):
        sum = 0
        sum += big_prizes(lot,all_prizes[:5])
        sum += next_to_first(lot,all_prizes[5])
        sum += digit_prizes(lot,all_prizes[6:])
        return sum

6630003621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 600, 'const': 720, 'code+const': 1320}
def prize_check (lot,prize):
    m=0
    for z in prize:
        if z == lot:
            m+=prize[-1]
    return m
def big_prizes (lot,prizes):
    i=0
    j=0
    while i < len(prizes):
        for a in prizes[i]:
            if a == lot:
                j+=prizes[i][-1]
        i+=1
    return j
def next_to_first(lot,prize):
    adjlot=int(lot)+1000000
    adj1st=int(prize[0])+1000000
    m=0
    if str(adjlot)[-6:] == str((adj1st+1))[-6:]:
        m+=prize[1]
    if str(adjlot)[-6:] == str((adj1st-1))[-6:]:
        m+=prize[1]
    return m
def first_digits_check(lot,prize):
    o=0
    for i in prize:
        if i == lot[0:3]:
            o+=prize[-1]
    return o
def last_digits_check(lot,prize):
    o=0
    if len(prize[0])==2:
        for i in prize:
            if i == lot[-2:]:
                o+=prize[-1]
    else:
        for i in prize:
            if i == lot[-3:]:
                o+=prize[-1]
    return o
def digit_prizes (lot,prize):
    j=first_digits_check(lot,prize[0])
    i=last_digits_check(lot,prize[1])
    k=last_digits_check(lot,prize[2])
    a=i+j+k
    return a
def total_prize (lot,all_prizes):
    a=big_prizes(lot,all_prizes[:5])
    b=digit_prizes (lot,all_prizes[6:])
    c=next_to_first(lot,all_prizes[5])
    d =a+b+c
    return d

6630006521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 498, 'const': 747, 'code+const': 1245}
def prize_check(lot, prize):
    count = 0
    for i in prize[:-1]:
        if lot == i:
            count += 1
    sum_prize = count*prize[-1]
    return sum_prize
def big_prizes(lot, prizes):
    sum_prize = 0
    for i in prizes:
        sum_prize += prize_check(lot, i)
    return sum_prize
def next_to_first(lot, prize):
    sum_prize = 0
    h_fp = ("000000" + str(int(prize[0]) + 1))[-6:]
    l_fp = ("000000" + str(int(prize[0]) - 1 + 1000000))[-6:]
    if lot == h_fp or lot == l_fp:
        sum_prize += prize[-1]
    return sum_prize
def first_digits_check(lot, prize):
    return prize_check(lot[:3], prize)
def last_digits_check(lot, prize):
    if len(prize[0]) == 2:
        return prize_check(lot[-2:], prize)
    if len(prize[0]) == 3:
        return prize_check(lot[-3:], prize)
def digit_prizes(lot, prizes):
    sum_prize = 0
    sum_prize += first_digits_check(lot, prizes[0])
    sum_prize += last_digits_check(lot, prizes[1])
    sum_prize += last_digits_check(lot, prizes[2])
    return sum_prize
def total_prize(lot, all_prizes):
    sum_prize = 0
    sum_prize += big_prizes(lot, all_prizes[:5])
    sum_prize += next_to_first(lot, all_prizes[5])
    sum_prize += digit_prizes(lot, all_prizes[6:])
    return sum_prize

6630011621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 678, 'const': 992, 'code+const': 1670}
def prize_check (lot,prize):
    money=0
    for i in range(len(prize)-1):
        if  lot==prize[i]:
            money +=int(prize[-1])
    return money
def big_prizes (lot,prizes):
    money=0
    for i in prizes:
        for k in i :
            if lot==k:
                money +=int(i[-1])
    return money
def next_to_first (lot,prize):
    money=0
    for i in range(len(prize)-1):
        if int(lot)==int(prize[i])-1 or int(lot)==int(prize[i])+1:
            money+=int(prize[-1])
        elif prize[i]=='000000' and( lot=='000001' or lot=='999999'):
                money+=int(prize[-1])
        elif prize[i]=='999999' and(lot=='000000' or lot=='999998'):
                money+=int(prize[-1])
    return money
def first_digits_check(lot,prize):
    money=0
    for i in range(len(prize)-1):
        if lot[:3]==prize[i] :
            money+=int(prize[-1])
    return money
def last_digits_check(lot,prize):
    money=0
    for i in range(len(prize)-1):
        if lot[3:]==prize[i] or lot[4:]==prize[i] :
            money+=int(prize[-1])
    return money
def digit_prizes (lot,prizes):
    money=0
    for i in prizes:
        for k in i :
            if lot[:3]==k or lot[3:]==k or lot[4:]==k :
                money +=int(i[-1])
    return money
def total_prize (lot,all_prizes):
    money=0
    money +=big_prizes(lot,all_prizes[:5])
    money +=next_to_first(lot,all_prizes[5])
    money +=digit_prizes (lot,all_prizes[6:])
    return money

6630012221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 538, 'const': 720, 'code+const': 1258}
def prize_check (lot,prize):
    reward = 0
    i = 0
    while i < len(prize):
        if lot == prize[i]:
            reward += prize[-1]
        i += 1
    return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    reward = 0
    i = 0
    prize = prizes
    for k in range(len(prizes)):
        reward += prize_check (lot,prize[k])
    return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    reward = 0
    if abs(int(lot)-int(prize[0])) == 1 or abs(int(lot)-int(prize[0])) == 999999:
        reward += prize[-1]
    return reward
#all_prizes[5].remove('555556')
#all_prizes[5].insert(1, '000000')
#all_prizes[5].insert(2, '999998')
#print(all_prizes[5])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    i = 0
    reward = 0
    while i < len(prize):
        if lot[0:3] == prize[i]:
            reward += prize[-1]
        i += 1
    return reward
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    reward = 0
    i = 0
    while i < len(prize):
        if lot[-3:] == prize[i] or lot[-2:] == prize[i]:
            reward += prize[-1]
        i += 1
    return reward
       # 2 8, 3 7
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    return big_prizes (lot,all_prizes[:5]) + next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6630038621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 574, 'const': 880, 'code+const': 1454}
def prize_check (lot,prize):
        k = 0
        for i in prize[:-1] :
          if lot == i:
              k += prize[-1]
        return k
def big_prizes (lot,prizes):
        s=0
        for i in range(len(prizes)):
            s += prize_check(lot,prizes[i])
        return s
def next_to_first (lot,prize):
        f = 0
        if prize[0] == '000000':
          pl = '999999'
          ph = '000001'
        elif prize[0] == '999999':
          pl = '999998'
          ph = '000000'
        else :
          p = int(prize[0])
          pl = p - 1
          ph = p + 1
        if int(lot) == int(pl) or int(lot) == int(ph):
            f += prize[-1]
        return f
def first_digits_check(lot,prize):
        u = 0
        for i in prize[:-1]:
          if lot[:3] == i:
            u += prize[-1]
        return u
def last_digits_check(lot,prize):
        y = 0
        for i in prize[:-1]:
          if len(i) == 2:
            if lot[4:] == i:
              y += prize[-1]
          else :
            if lot[3:] == i:
              y += prize[-1]
        return y
def digit_prizes (lot,prizes):
        z = 0
        z += first_digits_check(lot,prizes[0])
        z += last_digits_check(lot,prizes[1])
        z += last_digits_check(lot,prizes[2])
        return z
def total_prize (lot,all_prizes):
        q = 0
        q += big_prizes(lot,all_prizes[:5])
        q += digit_prizes(lot,all_prizes[6:])
        q += next_to_first(lot,all_prizes[5])
        return q

6630041421: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 614, 'const': 936, 'code+const': 1550}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
   prize_i = prize[0:len(prize)-1] ; reward_per = prize[-1] ; reward = 0
   for prize_i in prize_i :
      if lot == prize_i :
         reward += reward_per
   return reward
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
   str(lot) ; reward = 0
   for prizes in prizes :
      for i in range(len(prizes)-1) :
         if lot == prizes[i] :
            reward = reward + int(prizes[-1])
         else : reward += 0
   return reward
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
   reward_net = 0 ; prize_0 = prize[0]
   if prize[0] == '999999' :
      side_first = ['999998','000000',prize[1]]
   elif prize[0] == '000000' :
      side_first = ['999999','000001',prize[1]]
   #elif prize_0[0] == 0 :
      #prize_0.
   else : side_first = [int(prize[0])-1, int(prize[0])+1, prize[1]]
   for side_first in side_first[0:2] :
      reward_net += prize_check (int(lot),[int(side_first),prize[1]])
   return reward_net
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
   first_digi_lot = lot[0:3]
   return prize_check (first_digi_lot,prize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
   last_digi_lot = lot[6-len(prize[0]):6]
   return prize_check (last_digi_lot,prize)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
   return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
   reward_net = 0
   for i in range(7) :
      if 0 <= i <= 4 :
         reward_net += prize_check(lot,all_prizes[i])
      elif i == 5 :
         reward_net += next_to_first (lot,all_prizes[i])
      elif i == 6:
         reward_net += digit_prizes (lot,all_prizes[6:9])
   return reward_net

6630043721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 486, 'const': 660, 'code+const': 1146}
def prize_check (lot,prize):
    summation = 0
    for i in prize[:len(prize)-1] :
        if lot == i :
            summation = summation + prize[len(prize)-1]
    return summation
def big_prizes (lot,prizes):
    x = 0
    for i in range(5) :
        x += prize_check (lot,prizes[i])
    return x
def next_to_first (lot,prize):
    if lot == str(int(prize[0])+1000001)[-6::]         or lot == str(int(prize[0]) + 999999)[-6::] :
        return prize[-1]
    return 0
def first_digits_check(lot,prize):
    sum = 0
    for i in prize :
        if lot[:3] == i :
            sum += prize[len(prize)-1]
    return sum
def last_digits_check(lot,prize):
    sum = 0
    for i in prize[:len(prize)-1] :
        if lot[-len(i):] == i : sum += prize[len(prize)-1]
    return sum
def digit_prizes (lot,prizes):
    x = first_digits_check(lot,prizes[0]) +          last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
    return x
def total_prize (lot,all_prizes):
    x = big_prizes (lot,all_prizes[0:5]) +          next_to_first (lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])
    return x

6630048921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 570, 'const': 852, 'code+const': 1422}
def prize_check(lot,prize):
    total = 0
    for i in range(len(prize)):
        if lot == prize[i]:
            total += prize[-1]
    return total
def big_prizes(lot,prizes):
    total = 0
    for i in range (len(prizes)):
        total += prize_check(lot,prizes[i])
    return total
def next_to_first(lot,prize):
    total = 0
    if prize[0] == '000000' or prize[0] == '999999':
      if prize[0] == '000000'and (lot == '999999' or lot == '000001'):
        total = prize[-1]
      elif prize[0] == '999999'and (lot == '999998' or lot == '000000'):
        total = prize[-1]
    elif int(lot) == (int(prize[0])-1) or int(lot) == (int(prize[0])+1) :
        total = prize[-1]
    return total
def first_digits_check(lot,prize):
    total = 0
    total = prize_check(lot[:3],prize)
    return total
def last_digits_check(lot,prize):
    total = 0
    if len(prize[0]) == 2:
        total = prize_check(lot[-2:],prize)
    elif len(prize[0]) == 3:
        total = prize_check(lot[-3:],prize)
    return total
def digit_prizes(lot,prizes):
    total = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
    return total
def total_prize(lot,all_prizes):
    total = 0
    total += next_to_first(lot,all_prizes[5])
    total += big_prizes(lot,all_prizes[:5])
    total += digit_prizes(lot,all_prizes[6:])
    return total

6630058121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 810, 'const': 945, 'code+const': 1755}
def prize_check (lot,prize):
        x1 = []
        for i in range(len(prize)-1):
            if lot == prize[i]:
                x1.append(prize[-1])
            else:
                x1.append(0)
        x1=sum(x1)
        return x1
def big_prizes (lot,prizes):
        x2=[]
        for i in range(len(prizes)):
            x2.append(prize_check (lot,prizes[i]))
        x2_sum = sum(x2)
        return x2_sum
def next_to_first (lot,prize):
        x3=[]
        if prize[0] == '000000':
            if lot == '0000001' or lot == '999999':
                x3.append(prize[-1])
        if prize[0] == '999999':
            if lot == '999998' or lot == '000000':
                x3.append(prize[-1])
        if int(lot) == int(prize[0])+1 or int(lot) == int(prize[0])-1:
            x3.append(prize[-1])
        else:
            x3.append(0)
        x3=sum(x3)
        return x3
def first_digits_check(lot,prize):
        x4=[]
        for i in range(len(prize)-1):
            if lot[:3] == prize[i]:
                x4.append(prize[-1])
            else:
                x4.append(0)
        x4=sum(x4)
        return x4
def last_digits_check(lot,prize):
        x5=[]
        if len(prize[0]) == 2:
            for i in range(len(prize)-1):
                if lot[-2:] == prize[i]:
                    x5.append(prize[-1])
        elif len(prize[0]) == 3:
            for i in range(len(prize)-1):
                if lot[-3:] == prize[i]:
                    x5.append(prize[-1])
                else:
                    x5.append(0)
        x5=sum(x5)
        return x5
def digit_prizes (lot,prizes):
        x6=[]
        x6.append(first_digits_check(lot,prizes[0]))
        x6.append(last_digits_check(lot,prizes[1]))
        x6.append(last_digits_check(lot,prizes[2]))
        x6=sum(x6)
        return x6
def total_prize (lot,all_prizes):
        x7=[]
        for i in range(5):
            x7.append(prize_check(lot,all_prizes[i]))
        x7.append(next_to_first(lot,all_prizes[5]))
        x7.append(digit_prizes (lot,all_prizes[6:]))
        x7=sum(x7)
        return x7

6630059821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1254, 'const': 1492, 'code+const': 2746}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        x = 0
        for i in range(len(prize)-1):
                if lot == prize[i]:
                        x += prize[-1]
        return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        x = 0
        for i in range(len(prizes)):
                for j in range(len(prizes[i])-1):
                        if lot == prizes[i][j]:
                                x += prizes[i][-1]
        return x
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        p1 = prize[0]
        x = 0
        if p1 == '000000':
                if lot == '000001':
                        x += prize[-1]
                if lot == '999999':
                        x += prize[-1]
        elif p1 == '999999':
                if lot == '000000':
                        x += prize[-1]
                if lot == '999998':
                        x += prize[-1]
        else:
                if int(p1) - 1 == int(lot):
                        x += prize[-1]
                if int(p1) + 1 == int(lot):
                        x += prize[-1]
        return x
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        x = 0
        for i in range(len(prize)-1):
                if lot[:3] == prize[i]:
                        x += prize[-1]
        return x
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        x = 0
        for i in range(len(prize)-1):
                if len(prize[0]) == 3:
                        if lot[3:] == prize[i]:
                                x += prize[-1]
                if len(prize[0]) == 2:
                        if lot[4:] == prize[i]:
                                x += prize[-1]
        return x
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        x = 0
        for i in range(len(prizes[0])-1):
                if lot[:3] == prizes[0][i]:
                        x += prizes[0][-1]
        for i in range(len(prizes[1])-1):
                if lot[3:] == prizes[1][i]:
                        x += prizes[1][-1]
        for i in range(len(prizes[2])-1):
                if lot[4:] == prizes[2][i]:
                        x += prizes[2][-1]
        return x
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        x = 0
        for i in range(5):
                for j in range(len(all_prizes[i])-1):
                        if lot == all_prizes[i][j]:
                                x += all_prizes[i][-1]
        p1 = all_prizes[5][0]
        if p1 == '000000':
                if lot == '000001':
                        x += all_prizes[5][-1]
                if lot == '999999':
                        x += all_prizes[5][-1]
        elif p1 == '999999':
                if lot == '000000':
                        x += all_prizes[5][-1]
                if lot == '999998':
                        x += all_prizes[5][-1]
        else:
                if int(p1) - 1 == int(lot):
                        x += all_prizes[5][-1]
                if int(p1) + 1 == int(lot):
                        x += all_prizes[5][-1]
        for i in range(len(all_prizes[6])-1):
                if lot[:3] == all_prizes[6][i]:
                        x += all_prizes[6][-1]
        for i in range(len(all_prizes[7])-1):
                if lot[3:] == all_prizes[7][i]:
                        x += all_prizes[7][-1]
        for i in range(len(all_prizes[8])-1):
                if lot[4:] == all_prizes[8][i]:
                        x += all_prizes[8][-1]
        return x

6630064921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 612, 'const': 916, 'code+const': 1528}
def prize_check(lot, prize):
    n = 0
    for i in prize[:-1]:
        if lot == i:
            n += 1
    return prize[-1] * n
def big_prizes(lot, prizes):
    big_prizes_sum = []
    for i in prizes:
        big_prizes_sum.append(prize_check(lot, i))
    return sum(big_prizes_sum)
def next_to_first(lot, prize):
    n = 0
    if prize[0] == "000000":
        if lot == '999999':
            n += 1
        elif lot == "000001":
            n += 1
    elif prize[0] == "999999":
        if lot == '999998':
            n += 1
        elif lot == "000000":
            n += 1
    elif int(lot) == int(prize[0]) + 1:
        n += 1
    elif int(lot) == int(prize[0]) - 1:
        n += 1
    return prize[-1] * n
def first_digits_check(lot, prize):
    n = 0
    for i in prize[:-1]:
        if lot[:3] == i:
            n += 1
    return prize[-1] * n
def last_digits_check(lot, prize):
    n = 0
    if len(prize[0]) > 2:
        for i in prize[:-1]:
            if lot[-3:] == i:
                n += 1
    else:
        for i in prize[:-1]:
            if lot[-2:] == i:
                n += 1
    return prize[-1] * n
def digit_prizes(lot, prizes):
    return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize(lot, all_prizes):
    return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6630070621: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 610, 'const': 519, 'code+const': 1129}
def prize_check (lot,prize):
    money = 0
    for i in range(len(prize)):
        if type(prize[i]) == int:
            money = money+ prize.count(lot)*prize[i]
    return money
def big_prizes (lot,prizes):
    money = 0
    for j in range(len(prizes)):
        money += prize_check(lot,prizes[j])
    return money
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    money = 0
    nt = ''
    mnt = 0
    for i in range(len(prize)):
        if type(prize[i]) == int:
            mnt = prize[i]
        else:
            nt = prize[i]
    l = int(nt)-1
    r = int(nt)+1
    if l < 0:
        l = 999999
    if r > 999999:
        r = 0
    lot =int(lot)
    if l == lot or r == lot:
        return mnt
    return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    money = 0
    mfd = 0
    for i in range(len(prize)):
        if type(prize[i]) == int:
            mfd = prize[i]
    money += prize.count(lot[:3])*mfd
    return money
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    money = 0
    mld = 0
    sp = 0
    for i in range(len(prize)):
        if type(prize[i]) == int:
            mld = prize[i]
        else:
            sp = len(prize[i])
    money += prize.count(lot[-sp:])*mld
    return money
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    money = first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
    return money
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    money = big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) +digit_prizes(lot,all_prizes[-3:])
    return money

6630071221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 606, 'const': 992, 'code+const': 1598}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
    w = 0
    for i in prize[0:-1]:
        if lot == i:
            w += 1
    return prize[-1] * w
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
    big_prizes_sum = 0
    for i in prizes:
        for j in i[:-1]:
            if lot in j:
                big_prizes_sum += i[-1]
    return big_prizes_sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    w = 0
    for i in prize[0:-1]:
        if i == '000000':
            if lot == '999999' or lot == '000001':
                w += 1
        elif i == '999999':
            if lot == '999998'or lot == '000000':
                w += 1
        elif int(lot) == int(prize[0]) + 1 or          int(lot) == int(prize[0]) - 1:
            w += 1
    return prize[-1] * w
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
    w = 0
    for i in prize[0:-1]:
        if lot[0:3] == i:
            w += 1
    return prize[-1] * w
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    w = 0
    if len(prize[0]) > 2:
        for i in prize[:-1]:
            if lot[-3:] == i:
                w += 1
    else:
        for i in prize[:-1]:
            if lot[-2:] == i:
                w += 1
    return prize[-1] * w
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot, prizes[0]) + last_digits_check(lot, prizes[1]) + last_digits_check(lot, prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot, all_prizes[0:5]) + next_to_first(lot, all_prizes[5]) + digit_prizes(lot, all_prizes[6:])

6630077021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 516, 'const': 632, 'code+const': 1148}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for x in prize[0:-1]:
                if(int(lot) == int(x)):
                        money += prize[-1]
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได
        money = 0
        for x in range(len(prizes)):
                money += prize_check (lot,prizes[x])
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        num1 = int(lot) + 1
        if num1 == 1000000:
                num1 = 000000
        num2 = int(lot) - 1
        if num2 == -1:
                num2 = 999999
        money += prize_check(num1,prize)
        money += prize_check(num2,prize)
        return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # use len find digit
        money = 0
        for x in prize[0:-1]:
                #print(lot[0:len(x)-1])
                if(lot[0:len(x)] == x):
                        money += prize[-1]
        return money
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        money = 0
        # 012345 2 45
        for x in prize[0:-1]:
                #print(lot[6-len(x):])
                if(lot[6-len(x):] == x):
                        money += prize[-1]
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes AGVDbNVutgwiep6615bjTJnQkScwWuUEMuU95NredRG5 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        money += first_digits_check(lot,prizes[0])
        money += last_digits_check(lot,prizes[1])
        money += last_digits_check(lot,prizes[2])
        return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        money = 0
        money += big_prizes (lot,all_prizes[:5])
        money += next_to_first (lot,all_prizes[5])
        money += digit_prizes(lot,all_prizes[6:])
        return money

6630087321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1266, 'const': 2187, 'code+const': 3453}
import math
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for i in prize:
          if lot == i:
            money += prize[-1]
        return money
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        for win in prizes:
          for i in win:
              if lot == i:
                money += win[-1]
        return money
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        money = 0
        # first_prize_next_to = int(prize[0][-1]) +1
        # next_to1 = ''
        # next_to1 = prize[0][:-1]+str(first_prize_next_to)
        # second_prize_next_to = int(prize[0][-1]) -1
        # next_to2 = ''
        # next_to2 = prize[0][:-1]+str(second_prize_next_to)
        count = 0
        countlot = 0
        numb = ''
        numblot =''
        if prize[0] == '999999':
            if lot == '000000' or lot == '999998': #+
              money += prize[-1]
        elif prize[0] == "000001": #-
            if lot == '000000' or lot == '000002':
              money += prize[-1]
        elif prize[0] == "000000": #-
            if lot == '999999' or lot == '000001':
              money += prize[-1]
        elif prize[0] == '000010': #+
            if lot == '000009' or lot == '000011':
              money += prize[-1]
        elif prize[0] == '000009': #-
            if lot == '000008' or lot == '000010':
              money += prize[-1]
        elif prize[0] == '000100': #+
            if lot == '000099' or lot == '000101':
              money += prize[-1]
        elif prize[0] == '000099': #-
            if lot == '00098' or lot == '000100':
              money += prize[-1]
        elif prize[0] == '001000': #+
            if lot == '000999' or lot == '001001':
              money += prize[-1]
        elif prize[0] == '000999': #-
            if lot == '000998' or lot == '001000':
              money += prize[-1]
        elif prize[0] == '010000': #+
            if lot == '009999' or lot == '010001':
              money += prize[-1]
        elif prize[0] == '009999': #-
            if lot == '009998' or lot == '010000':
              money += prize[-1]
        elif prize[0] == '100000':
            if lot == '099999' or lot == '100001':
              money += prize[-1]
        elif prize[0] == '099999':
            if lot == '099998' or lot == '100000':
              money += prize[-1]
        else:
          for i in prize[0]:
            if i == '0':
              count += 1
            else:
              numb += i
              break
          numb = int(numb)
          for a in lot:
            if a == '0':
              countlot += 1
            else:
              numblot += a
              break
          if count == countlot and abs(int(lot) - int(prize[0])) == 1:
            next_to1 = str(int(numb)+1)
            next_to2 = str(int(numb)-1)
            money += prize[-1]
        return money
        return numb
        # next_to1 = str(int(prize[0])+1)
        # next_to2 = str(int(prize[0])-1)
        # if prize[0] == '999999':
        #   next_to1 = '000000'
        # if prize[0] == "000000":
        #   next_to2 = '999999'
        # if lot == next_to1:
        #   money += prize[-1]
        # if lot == next_to2:
        #   money += prize[-1]
        # return money
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        lot = lot[:3]
        for i in prize[:-1]:
          if lot == i:
            money += prize[-1]
        return money
def last_digits_check(lot,prize):
        money = 0
        if len(prize[0]) == 3:
            lot1 = lot[3:]
            for i in prize:
                if lot1 == i:
                    money += prize[-1]
        if len(prize[0]) == 2:
            lot2 = lot[4:]
            for i in prize:
              if lot2 == i:
                money += prize[-1]
        return money
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        money = 0
        money += first_digits_check(lot,prizes[0])
        money += last_digits_check(lot,prizes[1])
        money += last_digits_check(lot,prizes[2])
        return money
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        total_money =0
        total_money += big_prizes(lot,all_prizes[:5])
        total_money += next_to_first (lot,all_prizes[5])
        total_money += digit_prizes (lot,all_prizes[6:])
        return total_money

6630091821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1558, 'const': 1604, 'code+const': 3162}
def prize_check (lot,prize):
    money = 0
    x = prize[-1]
    for i in range(len(prize)-1):
        if lot == prize[i]:
            money = money + x
    return money
def big_prizes (lot,prizes):
    money = 0
    for i in range(len(prizes)):
        prize = prizes[i]
        x = prize[-1]
        y = 0
        for j in range(len(prize)-1):
            if lot == prize[j]:
                y = y + x
        money = money + y
    return money
def next_to_first (lot,prize):
    money0 = 0
    if prize[0] == '000000':
        if lot == '000001' or lot == '999999' :
            money0 = prize[1]
    elif prize[0] == '999999' :
        if lot == '000000' or lot == '999998' :
            money0 = prize[1]
    else:
        p = int(prize[0])
        if float(lot) == p + 1 or float(lot) == p - 1 :
            money0 = prize[1]
    return money0
def first_digits_check(lot,prize):
    money1d = 0
    for i in range(len(prize)-1):
        a = 0
        if lot[:2] == prize[i][:2]:
            a = prize[-1]
        money1d = money1d + a
    return money1d
def last_digits_check(lot,prize):
    moneyld = 0
    for i in range(len(prize)-1):
        money2d = 0
        money3d = 0
        a = 0
        if len(prize[i]) == 3:
            if lot[-3:] == prize[i][-3:]:
                a = prize[-1]
                money3d = money3d + a
                a=0
        elif len(prize[i]) == 2:
            if lot[-2:] == prize[i][-2:]:
                a = prize[-1]
                money2d = money2d + a
                a=0
        moneyld = moneyld + money3d + money2d
    return moneyld
def digit_prizes (lot,prizes):
    moneyd = 0
    for i in range(len(prizes)):
        prize = prizes[i]
        money1d = 0
        moneyld = 0
        money2d = 0
        money3d = 0
        if i == 0:
            for j in range(len(prize)-1):
                a = 0
                if lot[:2] == prize[j][:2]:
                    a = prize[-1]
                money1d = money1d + a
        elif i == 1 or i == 2:
            for j in range(len(prize)-1):
                money2d = 0
                money3d = 0
                a = 0
                if len(prize[j]) == 3:
                    if lot[-3:] == prize[j][-3:]:
                        a = prize[-1]
                        money3d = money3d + a
                        a=0
                elif len(prize[j]) == 2:
                    if lot[-2:] == prize[j][-2:]:
                        a = prize[-1]
                        money2d = money2d + a
                        a=0
                moneyld = moneyld + money3d + money2d
        moneyd = moneyd + money1d + moneyld
    return moneyd
def total_prize (lot,prizes):
    money = 0
    money0 = 0
    moneyd = 0
    total = 0
    for i in range(len(prizes)) :
        prize = prizes[i]
        x = prize[-1]
        y = 0
        money1d = 0
        moneyld = 0
        money2d = 0
        money3d = 0
        if i == 0 or i == 1 or i == 2 or i == 3 or i == 4:
            for j in range(len(prize)-1):
                if lot == prize[j]:
                    y = y + x
            money = money + y
        elif i == 5 :
            if prize[0] == '000000':
                if lot == '000001' or lot == '999999' :
                    money0 = prize[1]
            elif prize[0] == '999999' :
                if lot == '000000' or lot == '999998' :
                    money0 = prize[1]
            else:
                p = int(prize[0])
                if float(lot) == p + 1 or float(lot) == p - 1 :
                    money0 = prize[1]
        elif i == 6:
            for j in range(len(prize)-1):
                a = 0
                if lot[:2] == prize[j][:2]:
                    a = prize[-1]
                money1d = money1d + a
        elif i == 7 or i == 8:
            for j in range(len(prize)-1):
                money2d = 0
                money3d = 0
                a = 0
                if len(prize[j]) == 3:
                    if lot[-3:] == prize[j][-3:]:
                        a = prize[-1]
                        money3d = money3d + a
                        a=0
                elif len(prize[j]) == 2:
                    if lot[-2:] == prize[j][-2:]:
                        a = prize[-1]
                        money2d = money2d + a
                        a=0
                moneyld = moneyld + money3d + money2d
        moneyd = moneyd + money1d + moneyld
        total = money + money0 + moneyd
    return total

6630093021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 548, 'const': 660, 'code+const': 1208}
def prize_check (lot,prize):
    win = 0
    for e in prize :
        if lot == e :
            win += prize[-1]
    return win
def big_prizes (lot,prizes):
    win = 0
    for e in prizes :
        x = prize_check(lot,e)
        win += x
    return win
def next_to_first (lot,prize):
    win = 0
    n = []
    for i in range(2) :
        m = (int(prize[0]) + 1000000) + ((-1) ** (i + 1))
        n.append(str(m)[-6:])
    for e in n :
        if lot == e :
            win += prize[-1]
    return win
def first_digits_check(lot,prize):
    win = 0
    for e in prize[:-1] :
        if lot[:len(e)] == e :
            win += prize[-1]
    return win
def last_digits_check(lot,prize):
    win = 0
    for e in prize[:-1] :
        if lot[-len(e):] == e :
            win += prize[-1]
    return win
def digit_prizes (lot,prizes):
    win = 0
    for i in range(3):
        if i == 0 :
            win += first_digits_check(lot,prizes[i])
        else :
            win += last_digits_check(lot,prizes[i])
    return win
def total_prize (lot,all_prizes):
    win = 0
    for i in range(3) :
        if i == 0 :
            win += big_prizes (lot,all_prizes[:5])
        elif i == 1 :
            win += next_to_first (lot,all_prizes[5])
        else :
            win += digit_prizes (lot,all_prizes[6:])
    return win

6630095321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 638, 'const': 744, 'code+const': 1382}
def prize_check(lot,prizes):
    i = 0
    for n in prizes[:len(prizes)-1] :
        if n == lot :
            i += 1
    return i*int(prizes[-1])
def big_prizes(lot,prizes):
    p = 0
    for n in prizes :
        p += prize_check(lot,n)
    return p
def next_to_first(lot,prizes):
    i = 0
    for n in prizes[:len(prizes)-1]:
        a = int(n)+1000000
        b = int(a)-1
        c = int(a)+1
        if lot == str(b)[-6:] or lot == str(c)[-6:]:
            i += 1
    return i*int(prizes[-1])
def first_digits_check(lot,prizes):
    i = 0
    for n in prizes[:len(prizes)-1]:
        a = lot[0:3]
        if n == a :
            i += 1
    return i*int(prizes[-1])
def last_digits_check(lot,prizes):
    i = 0
    for n in prizes[:len(prizes)-1]:
        a = lot[(len(lot)-len(n)):len(lot)]
        if n == a :
            i += 1
    return i*int(prizes[-1])
def digit_prizes(lot,prizes):
    p = 0
    for n in range(3):
        if n == 0:
            p += first_digits_check(lot,prizes[n])
        else:
            p += last_digits_check(lot,prizes[n])
    return p
def total_prize(lot,prizes):
    p = 0
    for n in range(3):
        if n == 0 :
            p += big_prizes(lot,prizes[:5])
        elif n == 1 :
            p += next_to_first(lot,prizes[5])
        else :
            p += digit_prizes(lot,prizes[6:])
    return p

6631002121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 650, 'const': 964, 'code+const': 1614}
def prize_check (lot,prize):
    money = 0
    for i in range(len(prize) - 1):
        if lot in prize[i]:
            money += prize[-1]
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
def big_prizes (lot,prizes):
    money = 0
    for i in range(5):
        money += prize_check(lot, prizes[i])
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
    money = 0
    if prize[0] == "000000":
        if lot == "999999" or lot == "000001":
            money += prize[-1]
    elif prize[0] == "999999":
        if lot == "999998" or lot == "000000":
            money += prize[-1]
    else:
        if int(lot) == int(prize[0]) - 1 or int(lot) == int(prize[0]) + 1:
            money += prize[-1]
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    money = 0
    for e in prize[0:-1]:
        if e == lot[0:3]:
            money += prize[-1]
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    money = 0
    if len(prize[0]) == 3:
        for e in prize[0:-1]:
            if e == lot[-3:]:
                money += prize[-1]
    elif len(prize[0]) == 2:
        for e in prize[0:-1]:
            if e == lot[-2:]:
                money += prize[-1]
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
    money = 0
    money += first_digits_check(lot,prizes[0])
    money += last_digits_check(lot,prizes[1])
    money += last_digits_check(lot,prizes[2])
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
    money = 0
    money += big_prizes(lot,all_prizes[:5])
    money += next_to_first(lot,all_prizes[5])
    money += digit_prizes (lot,all_prizes[6:])
    return money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631023321: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 414, 'const': 584, 'code+const': 998}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for num in prize[:-1]:
          if int(lot)==int(num): sum+=prize[-1]
        return sum
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        sum = 0
        for prize in prizes:
          sum+=prize_check(lot,prize)
        return sum
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        left = int(lot)-1
        if left==-1: left=999999
        right = int(lot)+1
        if(right==1000000): right=0
        return prize_check(str(left),prize)+prize_check(str(right),prize)
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        return prize_check(lot[:3],prize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if len(prize[0])==3: return prize_check(lot[3:],prize)
        else: return prize_check(lot[4:],prize)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot,all_prizes[:5])+next_to_first(lot,all_prizes[+5])+digit_prizes(lot,all_prizes[6:])

6631026221: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 502, 'const': 854, 'code+const': 1356}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for num in prize[:-1]:
                if num == lot:
                        total += prize[-1]
        return total
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        for prize in prizes:
                total += prize_check(lot, prize)
        return total
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        num = prize[0]
        if num == '000000':
                nexts = ['999999','000001']
        elif num == '999999':
                nexts = ['999998','000000']
        else:
                num = int(num)
                next1 = '00000' + str(num-1)
                next1 = next1[-6:]
                next2 = '00000' + str(num+1)
                next2 = next2[-6:]
                nexts = [next1, next2]
        if lot in nexts:
                return prize[-1]
        else:
                return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        return prize_check(lot[:3], prize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        total = 0
        total += prize_check(lot[-2:], prize)
        total += prize_check(lot[-3:], prize)
        return total
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        total = 0
        total += first_digits_check(lot, prizes[0])
        total += last_digits_check(lot, prizes[1])
        total += last_digits_check(lot, prizes[2])
        return total
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        total = 0
        total += big_prizes(lot, all_prizes[:5])
        total += next_to_first(lot, all_prizes[5])
        total += digit_prizes(lot, all_prizes[6:])
        return total

6631130821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 698, 'const': 940, 'code+const': 1638}
def prize_check (lot,all_prize):
  money = 0
  f_prize = []
  f_prize = all_prize
  for i in all_prize[:-1]:
       if lot == i:
          money += all_prize[-1]
  return(money)
def big_prizes (lot,all_prizes):
  money = 0
  st_five = []
  st_five = all_prizes
  for i in st_five:
    for j in i[:-1]:
       if lot == j:
          money += i[-1]
  return(money)
def next_to_first (lot,all_prize):
    st_next_to_first = all_prize
    money = 0
    if all_prize[0] == '999999' :
         if lot == '000000' or lot == '999998' :
             return all_prize[-1]
         else :
             return 0
    if all_prize[0] == '000000' :
         if lot == '000001' or lot == '999999' :
             return all_prize[-1]
         else :
             return 0
    if int(lot) == int(st_next_to_first[0]) - 1:
       money += all_prize[-1]
    if int(lot) == int(st_next_to_first[0]) + 1:
       money += all_prize[-1]
    return(money)
def first_digits_check(lot,all_prize):
     st_first_digits_check = all_prize
     money = 0
     for i in range(len( st_first_digits_check) - 1):
        if  st_first_digits_check[i] == lot[:3]:
          money += all_prize[-1]
     return(money)
def last_digits_check(lot,all_prize):
     st_last_digits_check = all_prize
     money = 0
     if len(st_last_digits_check[0]) == 2 :
       for i in range(len( st_last_digits_check) - 1):
          if  st_last_digits_check[i] == lot[4::]:
            money += all_prize[-1]
     if len(st_last_digits_check[0]) == 3 :
       for i in range(len( st_last_digits_check) - 1):
          if  st_last_digits_check[i] == lot[3::]:
            money += all_prize[-1]
     return(money)
def digit_prizes (lot,all_prize):
  st_digit_prizes = first_digits_check(lot,all_prize[0])
  nd_digit_prizes = last_digits_check(lot,all_prize[1])
  rd_digit_prizes  = last_digits_check(lot,all_prize[2])
  money = st_digit_prizes + nd_digit_prizes + rd_digit_prizes
  return(money)
def total_prize (lot,all_prizes):
  st_total_prizes = big_prizes (lot,all_prizes[:5:])
  nd_total_prizes = next_to_first(lot,all_prizes[5])
  rd_total_prizes = digit_prizes(lot,all_prizes[6::])
  money = st_total_prizes + nd_total_prizes + rd_total_prizes
  return(money)

6631133721: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 572, 'const': 798, 'code+const': 1370}
def prize_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot :
      sum += prize[-1]
  return sum
def big_prizes(lot,prize):
  sum = 0
  for i in prize:
    for j in range(len(i)-1):
      if i[j] == lot:
        sum += i[-1]
  return sum
def next_to_first(lot,prize):
  pp = int(prize[0])
  before = str((pp-1 + 1000000)%1000000)
  after = str((pp+1 + 1000000)%1000000)
  while(len(before) < 6):
    before = '0' + before
  while(len(after) < 6):
    after = '0' + after
  if lot == before:
    return prize[1]
  if lot == after:
    return prize[1]
  return 0
def first_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[:3] :
      sum += prize[-1]
  return sum
def last_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[(6-len(prize[i])):] :
      sum += prize[-1]
  return sum
def digit_prizes(lot,prizes):
  return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6631453521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 452, 'const': 638, 'code+const': 1090}
def prize_check (lot ,prize:list):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        result = 0
        for i in prize:
                if lot == i:
                        result += (prize[- 1])
        return int(result)
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        result = 0
        for i in prizes:
                result += prize_check(lot, i)
        return result
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        ntf = [int(prize[0]) - 1, int(prize[0]) + 1]
        if ntf[0] == -1:
            ntf = [999999, 1]
        elif ntf[1] == 1000000:
            ntf = [999998, 0]
        if int(lot) in ntf:
                return prize[len(prize) - 1]
        else:
                return 0
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        lotFront = lot[:3]
        return prize_check(lotFront, prize)
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        lotLast = lot[6 - len(prize[0]) :]
        return prize_check(lotLast, prize)
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        fdc = first_digits_check(lot, prizes[0])
        ldc1 = last_digits_check(lot, prizes[1])
        ldc2 = last_digits_check(lot, prizes[2])
        return int(fdc + ldc1 + ldc2)
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        a = big_prizes(lot, all_prizes[:5])
        b = next_to_first(lot, all_prizes[5])
        c = digit_prizes(lot, all_prizes[6:])
        return int(a + b + c)

6631455821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 854, 'const': 798, 'code+const': 1652}
def getMoney(theprize):
  return theprize[-1]
def getPrizeNum(theprize):
  return theprize[:len(theprize)-1:1]
def prize_check (lot,prize):
  list_Prize = getPrizeNum(prize)
  prize_Money = getMoney(prize)
  sum_money = 0
  for myLot in list_Prize:
     if lot in myLot:
        sum_money += prize_Money
  return sum_money
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได
def big_prizes (lot,prizes):
    sum_money= 0
    for mono_prize in prizes:
       list_Prize = getPrizeNum(mono_prize)
       prize_Money = getMoney(mono_prize)
       for myLot in list_Prize:
         if lot in myLot:
           sum_money += prize_Money
    return sum_money
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
def next_to_first (lot,prize):
   list_Prize = getPrizeNum(prize)
   prize_Money = getMoney(prize)
   sum_Money = 0
   rl_Prize = int(list_Prize[0])
   top_Num = rl_Prize + 1
   bottom_Num = rl_Prize - 1
   if int(top_Num) > 999999 :
      top_Num = (top_Num - 999999)-1
      intmy = str(top_Num)
      top_Num = ((6-len(intmy))*('0')) + intmy
   if int(bottom_Num) < 0 :
      bottom_Num = 999999 - (abs(bottom_Num) - 1)
   #top_Num = ((6-len(str(top_Num)))*('0')) + str(top_Num) to set the number to 00000x form
   top_Num = ((6-len(str(top_Num)))*('0')) + str(top_Num)
   bottom_Num = ((6-len(str(bottom_Num)))*('0')) + str(bottom_Num)
   list_realprize = [str(top_Num) , str(bottom_Num)]
   for monoprize in list_realprize:
      if lot in monoprize:
         sum_Money += prize_Money
   return sum_Money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
def first_digits_check(lot,prize):
    dit3_lot = lot[:3:1]
    prize_Money = getMoney(prize)
    list_Prize = getPrizeNum(prize)
    sum_Money = 0
    for monoPrize in list_Prize:
       if dit3_lot in monoPrize:
          sum_Money += prize_Money
    return sum_Money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
def last_digits_check(lot,prize):
    dit3_lot = lot[3::1]
    dit2_lot = lot[4::1]
    sum_Money = 0
    prize_Money = getMoney(prize)
    list_Prize = getPrizeNum(prize)
    for monoPrize in list_Prize:
       if dit2_lot == monoPrize:
             sum_Money += prize_Money
       if dit3_lot in monoPrize:
             sum_Money += prize_Money
    return sum_Money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
def digit_prizes (lot,prizes):
   Firstdit3_lot = lot[:3:1]
   Lastdit3_lot = lot[3::1]
   Lastdit2_lot = lot[4::1]
   sum_Money = 0
   for sinPrize in prizes:
      prize_Money = getMoney(sinPrize)
      list_Prize = getPrizeNum(sinPrize)
      for monoPrize in list_Prize:
         if Lastdit2_lot == monoPrize:
             sum_Money += prize_Money
         if Lastdit3_lot in monoPrize:
             sum_Money += prize_Money
         else :
            if Firstdit3_lot in monoPrize:
                sum_Money += prize_Money
   return sum_Money
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
def total_prize (lot,all_prizes):
   sum_WonCash = 0
   sum_WonCash += big_prizes(lot,all_prizes[:5])
   sum_WonCash += next_to_first(lot,all_prizes[5])
   sum_WonCash += digit_prizes (lot,all_prizes[6:])
   return sum_WonCash
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก

6631468021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 818, 'const': 976, 'code+const': 1794}
def prize_check (lot,prize):
    result=0
    if lot in prize:
        match_count = sum(1 for digit in prize if digit == lot)
        result += (prize[-1]) * match_count
    else:
        result+=0
    return result
def big_prizes (lot,prizes):
    result=0
    for prize in prizes:
        result += prize_check(lot, prize)
    return result
def next_to_first (lot,prizes):
    x = int(lot)
    y=int(prizes[0])
    if y-x==1 or y-x==-1 or y-x==999999 or y-x==-999999:
        result=prizes[-1]
    else :
        result=0
    return result
def first_digits_check(lot,prize):
    result=0
    first_digits=lot[:3]
    if first_digits in prize:
        match_count = sum(1 for digit in prize if digit == first_digits)
        result += (prize[-1]) * match_count
    else:
        result+=0
    return result
def last_digits_check(lot,prize):
    result=0
    last_3digits = lot[3:]
    last_2digits = lot[4:]
    if last_3digits in prize:
        match_count = sum(1 for digit in prize if digit == last_3digits)
        result += (prize[-1]) * match_count
    if last_2digits in prize:
        match_count = sum(1 for digit in prize if digit == last_2digits)
        result += (prize[-1]) * match_count
    else:
        result+=0
    return result
def digit_prizes (lot,prizes):
    first_digits = lot[:3]
    last_3digits = lot[3:]
    last_2digits = lot[4:]
    result=0
    result+=first_digits_check(lot,prizes[0])
    result+=last_digits_check(lot,prizes[1])
    result+=last_digits_check(lot,prizes[2])
    return result
def total_prize (lot,all_prizes):
    first_3digits = lot[:3]
    last_3digits = lot[3:]
    last_2digits = lot[4:]
    x = int(lot)
    y=int(all_prizes[5][0])
    result=0
    result+=big_prizes(lot,all_prizes[:5])
    result+=next_to_first(lot,all_prizes[5])
    result+=digit_prizes(lot,all_prizes[6:])
    return result

6631509021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 572, 'const': 798, 'code+const': 1370}
def prize_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot :
      sum += prize[-1]
  return sum
def big_prizes(lot,prize):
  sum = 0
  for i in prize:
    for j in range(len(i)-1):
      if i[j] == lot:
        sum += i[-1]
  return sum
def next_to_first(lot,prize):
  pp = int(prize[0])
  before = str((pp-1 + 1000000)%1000000)
  after = str((pp+1 + 1000000)%1000000)
  while(len(before) < 6):
    before = '0' + before
  while(len(after) < 6):
    after = '0' + after
  if lot == before:
    return prize[1]
  if lot == after:
    return prize[1]
  return 0
def first_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[:3] :
      sum += prize[-1]
  return sum
def last_digits_check(lot,prize):
  sum = 0
  for i in range(len(prize)-1):
    if prize[i] == lot[(6-len(prize[i])):] :
      sum += prize[-1]
  return sum
def digit_prizes(lot,prizes):
  return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
  return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes (lot,all_prizes[6:])

6631552021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 672, 'const': 968, 'code+const': 1640}
def prize_check(lot, prize):
    total = 0
    for p in prize:
        if lot == p:
            total += int(prize[-1])
    return total
def big_prizes(lot, prizes):
    total_prize = 0
    for p in prizes:
        total_prize += prize_check(lot, p)
    return total_prize
def next_to_first(lot, prize):
    total = 0
    for p in prize:
        if int(p) - int(lot) == 1 or int(lot) - int(p) == 1:
            total += int(prize[-1])
    if prize[0] == '999999':
          total = 0
          if lot == '000000' or lot == '999998':
            total += int(prize[-1])
    if prize[0] == '000000':
          total = 0
          if lot == '000001' or lot == '999999':
            total += int(prize[-1])
    return total
def first_digits_check(lot,prize):
    total = 0
    for p in prize:
        if lot[:3] == p:
            total += int(prize[-1])
    return total
def last_digits_check(lot,prize):
    total = 0
    for p in prize:
        if lot[-3:] == p:
            total += int(prize[-1])
        if lot[-2:] == p:
            total += int(prize[-1])
    return total
def digit_prizes(lot, prizes):
    total = 0
    for p in prizes[0]:
        if lot[:3] == p:
            total += int(prizes[0][-1])
    for p in prizes[1]:
        if lot[-3:] == p:
            total += int(prizes[1][-1])
    for p in prizes[2]:
        if lot[-2:] == p:
            total += int(prizes[2][-1])
    return total
def total_prize(lot, all_prizes):
    total = big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5]) + first_digits_check(lot, all_prizes[6]) + last_digits_check(lot, all_prizes[8])
    return total

6631701121: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 726, 'const': 1052, 'code+const': 1778}
def prize_check (lot,prize):
  award=0
  for i in prize:
    if lot==i:
      award=award+prize[-1]
  return award
def big_prizes (lot,prizes):
  award=0
  if len(prizes)>5:
    prizes=prizes[:5]
  for i in prizes:
    for j in i:
      if lot==j:
        award=award+i[-1]
  return award
def next_to_first (lot,prize):
  award=0
  if prize[0]=='999999':
    if lot=='000000' or lot=='999998':
      award=award+prize[-1]
  elif prize[0]=='000000':
    if lot=='000001' or lot=='999999':
      award=award+prize[-1]
  elif int(lot)==int(prize[0])+1 or int(lot)==int(prize[0])-1:
    award=award+prize[-1]
  return award
def first_digits_check(lot,prize):
  award=0
  for i in prize:
    if lot[0:3]==i:
      award=award+prize[-1]
  return award
def last_digits_check(lot,prize):
  award=0
  if len(prize[0])==3:
    for i in prize:
      if lot[3:6]==i:
        award=award+prize[-1]
  if len(prize[0])==2:
    for j in prize:
      if lot[4:6]==j:
        award=award+prize[-1]
  return award
def digit_prizes (lot,prizes):
  award=0
  round=0
  for prize in prizes:
    if round==0:
      for i in prize:
        if lot[0:3]==i:
          award=award+prize[-1]
    if round==1:
      for j in prize:
        if lot[3:6]==j:
          award=award+prize[-1]
    if round==2:
      for k in prize:
        if lot[4:6]==k:
          award=award+prize[-1]
    round+=1
  return award
def total_prize (lot,all_prizes):
  a=big_prizes(lot,all_prizes[:5])
  b=next_to_first(lot,all_prizes[5])
  c=digit_prizes (lot,all_prizes[6:])
  return a+b+c

6632015521: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 516, 'const': 748, 'code+const': 1264}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        i = 0
        for e in prize :
            if e == lot :
                i += 1
            else :
                i += 0
        x = i*int(prize[-1])
        return x
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        i = 0
        for k in prizes :
            for o in range(len(k)-1):
                if k[o] == lot :
                    i += int(k[-1])
        return i
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        if abs(int(lot)-int(prize[0]))==1 or abs(int(lot)-int(prize[0]))==999999 :
            i = int(prize[1])
        else :
            i = 0
        return i
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        a = lot[0:3]
        i = 0
        for k in prize[0:-1] :
            if k == a :
                i += prize[-1]
        return i
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        if len(prize[0]) == 3 :
            a = lot[-3::1]
        else :
            a = lot[-2::1]
        i = 0
        for k in prize :
            if k == a :
                i += prize[-1]
        return i
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) + last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        return big_prizes(lot,all_prizes[:5]) + next_to_first(lot,all_prizes[5]) + digit_prizes(lot,all_prizes[6:])

6632078021: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 1058, 'const': 1280, 'code+const': 2338}
def prize_check (lot,prize):
    you = 0
    me = 0
    for i in prize :
        if lot == i :
          you = prize[-1]
          me += you
    return me
def big_prizes (lot,prizes):
    you = 0
    me = 0
    for i in prizes :
        for j in i :
            if lot == j :
              you = i[-1]
              me += you
    return me
def next_to_first (lot,prize):
    you = 0
    me = 0
    mylot=int(lot)
    lot_up=mylot+1
    lot_upp=str(lot_up)
    lot_uppp='0'*(6-int(len(lot_upp)))+lot_upp
    lotup=lot_uppp[-6::]
    lot_d='1'+lot
    lot_dd=int(lot_d)
    lot_ddd=lot_dd-1
    lotdownn=str(lot_ddd)
    lotdownnn='0'*(6-int(len(lotdownn)))+lotdownn
    lotdown=lotdownnn[-6::]
    for i in prize :
      if lotup == i or lotdown == i :
          you = prize[-1]
          me += you
    return me
def first_digits_check(lot,prize):
    you = 0
    me = 0
    first3 = lot[:3]
    for i in prize :
      if first3 == i :
          you = prize[-1]
          me += you
    return me
def last_digits_check(lot,prize):
    you = 0
    me = 0
    last2 = lot[-2:]
    last3 = lot[-3:]
    for i in prize :
        if last2 == i or last3 == i :
          you = prize[-1]
          me += you
    return me
def digit_prizes (lot,prizes):
    you = 0
    me = 0
    first3 = lot[:3]
    last2 = lot[-2:]
    last3 = lot[-3:]
    for i in prizes[0] :
       if first3 == i :
          you = prizes[0][-1]
          me += you
    for j in prizes[1] :
        if last3 == j :
          you = prizes[1][-1]
          me += you
    for k in prizes[2] :
        if last2 == k :
          you = prizes[2][-1]
          me += you
    return me
def total_prize (lot,all_prizes):
    you = 0
    me = 0
    first3 = lot[:3]
    last2 = lot[-2:]
    last3 = lot[-3:]
    mylot=int(lot)
    lot_up=mylot+1
    lot_upp=str(lot_up)
    lot_uppp='0'*(6-int(len(lot_upp)))+lot_upp
    lotup=lot_uppp[-6::]
    lot_d='1'+lot
    lot_dd=int(lot_d)
    lot_ddd=lot_dd-1
    lotdownn=str(lot_ddd)
    lotdownnn='0'*(6-int(len(lotdownn)))+lotdownn
    lotdown=lotdownnn[-6::]
    for i in all_prizes[:4] :
        for j in i :
            if lot == j :
              you = i[-1]
              me += you
    for k in all_prizes[5] :
      if lotup == k or lotdown == k :
          you = all_prizes[5][-1]
          me += you
    for l in all_prizes[6] :
       if first3 == l :
          you = all_prizes[6][-1]
          me += you
    for m in all_prizes[7] :
        if last3 == m :
          you = all_prizes[7][-1]
          me += you
    for n in all_prizes[8] :
        if last2 == n :
          you = all_prizes[8][-1]
          me += you
    return me

6632092821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 434, 'const': 578, 'code+const': 1012}
def prize_check (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
    # คืนผลรวมของเงินรางวัลที่ได้
    return prize[-1]*prize.count(lot)
def big_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
    # คืนผลรวมของเงินรางวัลที่ได้
    rewards = 0
    for i in prizes:
        rewards += i.count(lot)*i[-1]
    return rewards
def next_to_first (lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
    # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
    prize_next = []
    next_num_1, next_num_2 = int('2'+prize[0])-1, int('2'+prize[0])+1
    prize_next.append(str(next_num_1)[1:])
    prize_next.append(str(next_num_2)[1:])
    prize_next.append(prize[-1])
    return prize_check(lot, prize_next)
def first_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    return prize_check(lot[:3],prize)
def last_digits_check(lot,prize):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
    # คืนผลรวมของเงินรางวัลที่ได้
    # ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    return prize_check(lot[6-len(prize[0]):], prize)
def digit_prizes (lot,prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
    # คืนผลรวมของเงินรางวัลที่ได้
    rewards = 0
    rewards += first_digits_check(lot, prizes[0])
    rewards += last_digits_check(lot, prizes[1])+ last_digits_check(lot, prizes[2])
    return rewards
def total_prize (lot,all_prizes):
    # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
    # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
    # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
    total = 0
    total += big_prizes(lot, all_prizes[:5])
    total += next_to_first(lot, all_prizes[5])
    total += digit_prizes(lot, all_prizes[6:])
    return total

6632184921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 610, 'const': 804, 'code+const': 1414}
def prize_check (lot,prize):
        return sum([prize[-1] if lot == p else 0 for p in prize[:-1]])
def big_prizes (lot,prizes):
        return sum([prize_check(lot, prize) for prize in prizes])
def next_to_first (lot,prize):
        p1 = (int(prize[0]) + 1) % 1_000_000
        p2 = (int(prize[0]) - 1 + 1_000_000) % 1_000_000
        return prize[-1] if int(lot) in [p1, p2] else 0
def first_digits_check(lot,prize):
        return sum([prize[-1] if lot[0:3] == p else 0 for p in prize[:-1]])
def last_digits_check(lot,prize):
        if len(prize[0]) == 3:
                return sum([prize[-1] if lot[3:] == p else 0 for p in prize[:-1]])
        else:
                return sum([prize[-1] if lot[4:] == p else 0 for p in prize[:-1]])
def digit_prizes (lot,prizes):
        return first_digits_check(lot, prizes[0])                 + sum([last_digits_check(lot, prize) for prize in prizes[1:]])
def total_prize (lot,all_prizes):
        return big_prizes(lot, all_prizes[:5]) + next_to_first(lot, all_prizes[5])                 + digit_prizes(lot, all_prizes[6:])

6632260921: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 618, 'const': 936, 'code+const': 1554}
def prize_check (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือ ลิสต์ย่อยรางวัลใหญ่ 1 รางวัล
        # คืนผลรวมของเงินรางวัลที่ได้
        c = 0
        for i in range(len(prize)-1):
          if lot in prize[i]:
            c+=prize[-1]
        return c
def big_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือ ลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลที่ 1-5
        # คืนผลรวมของเงินรางวัลที่ได้
        c = 0
        for i in range(len(prizes)):
          for j in range(len(prizes[i])-1):
            if lot==prizes[i][j]:
              c+=prizes[i][-1]
        return c
def next_to_first (lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลข้างเคียงรางวัลที่ 1
        # คืนผลรวมของเงินรางวัลข้างเคียงรางวัลที่1 ที่ได้
        c = 0
        if prize[0]=="000000" and (lot=="000001" or lot=="999999"):
          c+=prize[-1]
        elif prize[0]=="999999" and (lot=="999998" or lot=="000000"):
          c+=prize[-1]
        else:
          if int(lot)==int(prize[0])+1 or int(lot)==int(prize[0])-1:
            c+=prize[-1]
        return c
def first_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขหน้า 3 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        c = 0
        for i in range(len(prize)-1):
          if lot[:3]==prize[i]:
            c+=prize[-1]
        return c
def last_digits_check(lot,prize):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prize คือลิสต์ย่อยรางวัลเลขท้าย 3 ตัว หรือ 2 ตัว
        # คืนผลรวมของเงินรางวัลที่ได้
        # ลิขสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        c = 0
        for i in range(len(prize)-1):
          if lot[-len(prize[0]):] in prize[i]:
            c+=prize[-1]
        return c
def digit_prizes (lot,prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # prizes คือลิสต์ที่ประกอบด้วยลิสต์ย่อยรางวัลเลขหน้า 3 ตัว เลขท้าย 3 ตัว และ เลขท้าย 2 ตัว ตามลำดับ
        # คืนผลรวมของเงินรางวัลที่ได้
        c = 0
        c += first_digits_check(lot,prizes[0])+last_digits_check(lot,prizes[1])+last_digits_check(lot,prizes[2])
        return c
def total_prize (lot,all_prizes):
        # lot คือหมายเลขสลากที่ต้องการตรวจรางวัล ในรูปแบบ str
        # all_prizes คือลิสต์ที่ประกอบด้วย "ลิสต์ย่อยรางวัล" ทุกรางวัลตามลำดับในตัวอย่าง
        # คืนผลรวมของเงินรางวัลที่ได้จากทุกรางวัลที่ออก
        c = 0
        c += big_prizes(lot,all_prizes[:5])+next_to_first (lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])
        return c

6632263821: HW03
testfuncscerrstu_stdoutstu_keptstu_fout
test_prize_check_11.0
[111111, 456789, 12345, 0]
test_prize_check_21.0
[2468, 3702, 0]
test_big_prizes_11.0
[1083]
test_big_prizes_21.0
[1083]
test_next_to_first_11.0
[0, 987, 987]
test_next_to_first_21.0
[0, 987, 987, 987, 987, 987, 987]
test_first_digits_check_11.0
[0, 71, 71]
test_first_digits_check_21.0
[0, 142, 142]
test_last_digits_check_11.0
[0, 142, 142]
test_last_digits_check_21.0
[0, 0, 71]
test_digit_prizes_11.0
[0, 23, 23, 29, 29, 53]
test_digit_prizes_21.0
[0, 111]
test_total_prize1.0
[186005]
bytecount: {'code': 580, 'const': 884, 'code+const': 1464}
def prize_check (lot,prize):
    sum_money=0
    for e in prize:
        if e==lot:
            sum_money+=prize[-1]
    return sum_money
def big_prizes (lot,prizes):
    sum_money=0
    for e in prizes:
        for i in e:
            if i==lot:
                sum_money+=e[-1]
    return sum_money
def next_to_first (lot,prize):
    sum_money=0
    if prize[0]=='000000':
        if lot=='999999' or lot=='000001':
            sum_money+=prize[1]
            return sum_money
    if prize[0]=='999999':
        if lot=='000000' or lot=='999998':
            sum_money+=prize[1]
            return sum_money
    if int(lot)==(int(prize[0])+1) or int(lot)==(int(prize[0])-1):
        sum_money+=prize[1]
        return sum_money
    return sum_money
def first_digits_check(lot,prize):
    sum_money=0
    for e in prize:
        if int(e)==int(lot)//1000:
            sum_money+=prize[-1]
    return sum_money
def last_digits_check(lot,prize):
    sum_money=0
    if len(prize[0])==3:
        for e in prize:
            if int(e)==int(lot)%1000:
                sum_money+=prize[-1]
    if len(prize[0])==2:
        if int(lot)%100==int(prize[0]):
            sum_money+=prize[-1]
    return sum_money
def digit_prizes (lot,prizes):
    return first_digits_check(lot,prizes[0]) + last_digits_check(lot,prizes[1]) +last_digits_check(lot,prizes[2])
def total_prize (lot,all_prizes):
    return big_prizes (lot,all_prizes[:5])+next_to_first(lot,all_prizes[5])+digit_prizes (lot,all_prizes[6:])