0

So I have this list of strings. They all of the strings have a 18 capital letters.
I want to assign each letter a value and them sum up the total score.

window=['SALHWRAAGAATVLLVIVL', 'ALHWRAAGAATVLLVIVLL', 'LHWRAAGAATVLLVIVLLA', 'HWRAAGAATVLLVIVLLAG', 'WRAAGAATVLLVIVLLAGS', 'RAAGAATVLLVIVLLAGSY', 'AAGAATVLLVIVLLAGSYL', 'AGAATVLLVIVLLAGSYLA', 'GAATVLLVIVLLAGSYLAV', 'AATVLLVIVLLAGSYLAVL', 'ATVLLVIVLLAGSYLAVLA', 'TVLLVIVLLAGSYLAVLAE', 'VLLVIVLLAGSYLAVLAER', 'LLVIVLLAGSYLAVLAERG', 'LVIVLLAGSYLAVLAERGA', 'VIVLLAGSYLAVLAERGAP', 'IVLLAGSYLAVLAERGAPG', 'VLLAGSYLAVLAERGAPGA', 'LLAGSYLAVLAERGAPGAQ', 'LAGSYLAVLAERGAPGAQL', 'AGSYLAVLAERGAPGAQLI', 'GSYLAVLAERGAPGAQLIT', 'SYLAVLAERGAPGAQLITY', 'YLAVLAERGAPGAQLITYP', 'LAVLAERGAPGAQLITYPR', 'AVLAERGAPGAQLITYPRA', 'VLAERGAPGAQLITYPRAL', 'LAERGAPGAQLITYPRALW', 'AERGAPGAQLITYPRALWW', 'ERGAPGAQLITYPRALWWS', 'RGAPGAQLITYPRALWWSV', 'GAPGAQLITYPRALWWSVE', 'APGAQLITYPRALWWSVET', 'PGAQLITYPRALWWSVETA', 'GAQLITYPRALWWSVETAT', 'AQLITYPRALWWSVETATT', 'QLITYPRALWWSVETATTV', 'LITYPRALWWSVETATTVG', 'ITYPRALWWSVETATTVGY', 'TYPRALWWSVETATTVGYG', 'YPRALWWSVETATTVGYGD', 'PRALWWSVETATTVGYGDL', 'RALWWSVETATTVGYGDLY', 'ALWWSVETATTVGYGDLYP', 'LWWSVETATTVGYGDLYPV', 'WWSVETATTVGYGDLYPVT', 'WSVETATTVGYGDLYPVTL', 'SVETATTVGYGDLYPVTLW', 'VETATTVGYGDLYPVTLWG', 'ETATTVGYGDLYPVTLWGR', 'TATTVGYGDLYPVTLWGRC', 'ATTVGYGDLYPVTLWGRCV', 'TTVGYGDLYPVTLWGRCVA', 'TVGYGDLYPVTLWGRCVAV', 'VGYGDLYPVTLWGRCVAVV', 'GYGDLYPVTLWGRCVAVVV', 'YGDLYPVTLWGRCVAVVVM', 'GDLYPVTLWGRCVAVVVMV', 'DLYPVTLWGRCVAVVVMVA', 'LYPVTLWGRCVAVVVMVAG', 'YPVTLWGRCVAVVVMVAGI', 'PVTLWGRCVAVVVMVAGIT', 'VTLWGRCVAVVVMVAGITS', 'TLWGRCVAVVVMVAGITSF', 'LWGRCVAVVVMVAGITSFG', 'WGRCVAVVVMVAGITSFGL', 'GRCVAVVVMVAGITSFGLV', 'RCVAVVVMVAGITSFGLVT', 'CVAVVVMVAGITSFGLVTA', 'VAVVVMVAGITSFGLVTAA', 'AVVVMVAGITSFGLVTAAL', 'VVVMVAGITSFGLVTAALA', 'VVMVAGITSFGLVTAALAT', 'VMVAGITSFGLVTAALATW', 'MVAGITSFGLVTAALATWF', 'VAGITSFGLVTAALATWFV', 'AGITSFGLVTAALATWFVG', 'GITSFGLVTAALATWFVGR', 'ITSFGLVTAALATWFVGRE', 'TSFGLVTAALATWFVGREQ', 'SFGLVTAALATWFVGREQE', 'FGLVTAALATWFVGREQER', 'GLVTAALATWFVGREQERR', 'LVTAALATWFVGREQERRG', 'VTAALATWFVGREQERRGH']

Any ideas on how I could do this?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by slate
1

Suppose you have a score function that gives score to each letter.
So the score of all the windows is:
sum(sum(score(c) for c in w) for w in window)

Votes + Comments
That's a nice-looking one liner.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.