I am new at programming. I am trying to match a number (given by the user) to the numeric values of words in a file. Example a=1. b=2, c=3, A=1, B=2, so that if the user enters “2” then the output would be all words in the list that match 2.
userinput = raw_input("Please, enter the gematric value of the word: ")
inputfile = open('c:/school/dictionarytest.txt', 'r')
inputfile.lower()
output = []
for word in inputfile:
userinput = ord(character) - 96
output.append(character)
print output
inputfile.close()
I am somewhat new at this and the syntax is not that familiar. Could someone please help? Thank you
Edit1- example the user enters the number 7. If the word bad (b=2,a=1,d=4) is on the list the output would be “bad”, and any other words that match the addition of their characters.
Here’s the code with comments that describe it in detail:
Where
gematric_value()function is:Note: don’t use the above comment style in your code. It is acceptable only for educational purposes. You should assume that a reader of your code is familiar with Python.