Home/Support/Support Forum/Is it possible to get the value of a variable using an inputted string?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Is it possible to get the value of a variable using an inputted string?

0 votes
Hello all,

I would like to make a program that gives the value of a word based on all the letters added up with A being 1, B being 2 C being 3 etc. The code i am trying to use (and can't) is:

A=1
B=2
C=3
Etc...
Word = rawinput('text:')
Wordlen = len(word)
Counter = 0
Finalword =0
While wordlen > counter
Finalword =+ input (word[counter])
Counter =+ 1
print (finalword)

I'm only a beginner and am doing this for no reason but I can't find an answer anywhere! When i run the program i get the first letter in the list every time and i sorta know why but I couldn't find a better way to do it and nothing seems to work. And can someone explain why every time i type in 'counter' after typing in the word i get the next letter in the word?

Thanks




I didn't find the right solution from the internet.
References:
https://www.codecademy.com/forum_questions/5383e99d548c35f4060011b3

website builder software
asked Nov 1, 2017 in Python by Johneames New to the Community (0 points)

Please log in or register to answer this question.

...