Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Hello, working on a simple program but I am at a loss since I am not geting the results that I thought I would get. I am trying to get the user to enter a name and have that name added to the list. But instead of adding the name to the list it is creating a new element for each letter in the name instead of the name it's self. the results look like this printed out.

['mike', 'tom', 'bob', 'l', 'a', 'r', 's']

Here is the code...

name = ["mike", "tom", "bob"]
print name

name_entree = raw_input("Please enter a name: ")
person = name_entree
name += person

print
print name

# I know I covered this in the book but for the life of me I can't seem to find it. Any clarification would be great.

-Lars
 
First of all there is no need for the person variable in your code.

Second, the code should read:

Code:
name_entree = raw_input("Please enter a name: ")
name.append(name_entree)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.