shadwickman 159 Posting Pro in Training

Hello EAnder - welcome to DaniWeb. I myself only got into Python about a year ago, after deciding to give up on Java and C++; luckily I found that Python is fast, easy, and most importantly, fun.
Anyways, to get back on topic, I created the basis for a sort of artificial intelligence a while back, but gave up on it after a little bit. I hadn't gotten into making the computer give feedback/sentences to the user, but it's able to recognize around 2500 words (plurals, all conjugations, etc.) based on word lists it reads from/writes to. I've always really been interested in AI and such, and after looking at Eliza, decided I'll try rebuilding my old AI and try to figure out ways to streamline/advance it.
I don't know of any tutorials on AI or AL, but just started programming my AI from my own ideas. Due to this, my system might be badly designed, but if I make any significant advances in the next while, I'll post my source here on DaniWeb for you to look at.
Good luck with your programming!

shadwickman 159 Posting Pro in Training

Python often -- very often! -- has slick ways of doing things. In this case, the .count() method is a slick way of optimizing your function:

Oh - that's quite a handy function! There are so many more little helpful things like count() in Python than there is in Java. Thank you for the enlightenment :)

shadwickman 159 Posting Pro in Training

This is how your script should look:

def Numero(name):
    
    
    alpha = { 'a': 1, 'b': 2, 'c': 3, 'd': 4}
    counter1 = 0
    counter2 = 0
    
    
    while counter1 != len(name):
        for key, value in alpha.items():
            if key in name[counter1]:
                counter2 += value

        counter1 += 1  # Indented into the while loop
    
    return counter2

# This line calls the function and sets myFunc' to counter2
myFunc = Numero("abcd")
# Print the function to see what it equals...
print myFunc
shadwickman 159 Posting Pro in Training

I'm pretty new to Python aswell, and am still very confused with the way for loops are structured (as opposed to Java or C++). I think the issue you have is with the indentation. The second to last line, 'counter1 += 1' should be within the while loop shouldn't it? Otherwise the loop will keep going and be infinite. If you just indent that line so that it's within the while loop, it should fix the problem. :)

shadwickman 159 Posting Pro in Training

Python is quite an exceptional language, and although powerful, you can learn how to make simple applications quite easily. I got a basic education of Python just by searching Google for tutorials, and asking questions on DaniWeb. Once you understand how it works, you can then get into more complicated stuff like Tkinter and wxPython for GUIs. Just get Python 2.5 and you can start programming/learning. Have fun :) !