DEV Community

Discussion on: Daily Challenge #110 - Love VS. Friendship

Collapse
 
jbristow profile image
Jon Bristow
words_to_marks("",0).
words_to_marks(S,Mark) :-
    string_codes(S,SC),
    length(SC, SCL),
    sum_list(SC,SCS),
    Mark is SCS - SCL * 96.
?- words_to_marks(“love”, V).
% V = 54

?- words_to_marks(“declarative”, V).
% V = 100