All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Cheap or expensive (Posted on 2023-08-16) Difficulty: 2 of 5
If one assigns $ prices to a letter by its place in the English alphabet i.e. A=1, B=2, .. ..Y=25, Z=26 and the price of a word equals sum of its letters' values - (e.g, DOG is valued @ US$ 26)

find the n-letter words with the lowest and the highest prices:

n=3, 4, .... 10, 11

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution different word list, some results different | Comment 2 of 3 |
I get,
3    4 ['aba', 'baa']    66 ['wry']
4    6 ['abba', 'baba']    86 ['muzz']
5    8 ['abaca']    111 ['muzzy']
6    18 ['acacia']    127 ['syzygy']
7    21 ['cabbage']    134 ['surtout']
8    30 ['dahabeah']    156 ['susurrus']
9    37 ['beachhead']    171 ['susurrous']
10    46 ['baldheaded']    183 ['tumultuous']
11    39 ['cabbagehead']    207 ['trustworthy']

the list "words" contains 46888 words in lower case
-------------
wlen = [[w for w in words if len(w) == i] for i in range(0,15)]

v = '0abcdefghijklmnopqrstuvwxyz'

for n in range(3,12):
    scoremax = 0
    maxwords = []
    scoremin = 1000000
    minwords = []
    for w in wlen[n]:
        score = 0
        for c in w:
            try:
                score += v.index(c)
            except:
                print(w,c)
                    
        if score > scoremax:
            scoremax = score
            maxwords = [w]
        elif score == scoremax:
            maxwords.append(w)
        if score < scoremin:
            scoremin = score
            minwords = [w]
        elif score == scoremin:
            minwords.append(w)
    print(n,'  ',scoremin, minwords,'  ',scoremax, maxwords)

  Posted by Larry on 2023-08-16 09:40:56
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (5)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information