makersacademy / problem-solving

For problem-solving during the PreCourse
6 stars 2 forks source link

Chapter 8 Question 1 #160

Closed darciew closed 6 years ago

darciew commented 6 years ago

Not sure how to match the values to the users word and add them all together?

At the moment it is just printing out the word...

screen shot 2018-08-21 at 13 35 28 screen shot 2018-08-21 at 13 35 49

Any ideas on where I am going wrong?

afaraone commented 6 years ago

It looks like the strings in word are lower case. Does it work with upper case?

jonurry commented 6 years ago

Hi Darcie, There's no need to iterate over the points hash. you already know the letter, so to get the points value for that letter you can say: points[letter] Also, afaraone is correct. You need to be using upper case letters or converting them to upper case before accessing the hash keys.

darciew commented 6 years ago

thanks both :)

screen shot 2018-08-21 at 14 09 31

That seemed to do the trick now I am just left with the values printed - do I use sum to add them all up?

jonurry commented 6 years ago

you can keep a running total in a variable (increment the total score for each letter) and output the total score at the end

darciew commented 6 years ago

thanks @jonurry!