Skip to content

Commit 1b126b0

Browse files
committed
Finished working on scrabble score challenge
1 parent 997e511 commit 1b126b0

File tree

3 files changed

+30
-40
lines changed

3 files changed

+30
-40
lines changed
Binary file not shown.
Binary file not shown.

scrabble-score/scrabble_score.py

+30-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
1-
import random
2-
import operator
3-
41
def score(word):
5-
print("welcome to the letter game challenge")
6-
response=input("enter a word:\n")
7-
print(format(response)) # prints the word you have entered
8-
9-
letterpoints = { "E":(1),
10-
"A":(2),
11-
"R":(3),
12-
"I":(4),#values for each number as shown "i" = 4
13-
"O":(5),
14-
"T":(6),
15-
"N":(7),
16-
"S":(8),# values for each number again "s" = 4
17-
"L":(9),
18-
"C":(10),
19-
"U":(11),
20-
"D":(12),
21-
"P":(13),
22-
"M":(14),
23-
"H":(15),
24-
"G":(16),
25-
"B":(17),
26-
"F":(18),
27-
"Y":(19),
28-
"W":(20),
29-
"K":(21),
30-
"V":(22),
31-
"X":(23),
32-
"Z":(24),
33-
"J":(25),
34-
"Q":(26),
2+
letterpoints = { "A":(1),
3+
"E":(1),
4+
"I":(1),
5+
"O":(1),
6+
"U":(1),
7+
"L":(1),
8+
"N":(1),
9+
"R":(1),
10+
"S":(1),
11+
"T":(1),
12+
"D":(2),
13+
"G":(2),
14+
"B":(3),
15+
"C":(3),
16+
"M":(3),
17+
"P":(3),
18+
"F":(4),
19+
"H":(4),
20+
"V":(4),
21+
"W":(4),
22+
"Y":(4),
23+
"K":(5),
24+
"J":(8),
25+
"X":(8),
26+
"Q":(10),
27+
"Z":(10),
3528
}
36-
37-
response = response.upper()
29+
word = word.upper()
3830
total = 0
39-
for letter in response:
31+
for letter in word:
4032
total += letterpoints.get(letter)
41-
42-
print('your score is {}'.format(total))
43-
44-
pass
33+
return(total)
34+
pass

0 commit comments

Comments
 (0)