Day 9 of my mission to learn Python in Excel.
You can watch my Excel-based walkthrough of the same case here (spoiler alert: it's a lot faster!):
• Pattern matching in text with FIND (FMWC E...
You can access all the files I use as I work through this (at least the ones I'm able to share) here:
https://1drv.ms/f/s!Aryypvyx4xIO3BDB5...
or just type in:
bit.ly/PythonLearningFolder
If you want to try this problem yourself, you can buy it from the @FMWC store here:
https://www.fmworldcup.com/product/la...
This is the Python code I used:
Setup:
clMap = xl("Q13:R19", headers=True)
L1:
[lList.count([cd for nm, cd in clMap.values if nm == name][0]) for name, notUsed, lList in xl("G46:I55").values]
L2:
[lList.index([cd for nm, cd in clMap.values if nm == name][0])+1 for name, notUsed, lList in xl("G68:I87").values]
L3:
[max([lList[0].index(cd)+1 for cd in clMap.Output]) for lList in xl("G101:G120").values]
L4:
[max([lList[0][(loc1:=lList[0].index(cd1)):].index(cd2) + loc1 + 1 for cd1, cd2 in xl("H123:I125").values]) for lList in xl("G134:G153").values]
(this requires S, O; U, P; T, H in cells H123:I125)
L5:
import regex as re
[max([((splList:=re.split("(SL|OL|SR|OR|U|P|T|H)",lList[0]))[(loc1:=splList.index(cd1)):].index(cd2) + loc1 + 1)/2 for cd1, cd2 in xl("H155:I158").values]) for lList in xl("G167:G196").values]
(this requires SL, OL; SR, OR; U, P; T, H in cells H155:I158)
You can watch the recording of the e-sports battle based on this question here:
• Battle III - Road to Las Vegas 2023 (Excel...