I'm an R newbie and am trying to create a basic "database" for my comic books. However, I have a problem.
The idea is to place each new entry as a list. I assumed that I could set up the lists to look like the following.
[Thor, 50, Marvel]
[Thor, 51, Marvel]
[Thor, 52, Marvel]
...
eventually, I 'd like to include entries for story arc, writer, artist, etc.
However, I'm using the following code to enter in the comics and have found that each new entry is just added to the end of the list.
option = 0
comicdb = []
while option != 3:
print "--------------------------"
print "1. Add a New Comic Book"
print "2. Print the Database"
print "3. Quit"
option = int(raw_input("Pick an Option: "))
if option == 1:
title = raw_input("Comic Book Title: ")
issue = int(raw_input("Issue Number: "))
publisher = raw_input("Publisher: ")
comicdb.append(title)
comicdb.append(issue)
comicdb.append(publisher)
print comicdb
After running the code a couple times, the list looks like:
['Thor', 50, 'Marvel', 'Thor', 51, 'Marvel', 'Thor', 52, 'Marvel']
I'm assuming that one of the following things is wrong, but I can't figure it out:
- append is the wrong command to use
- i should use a dictionary or tuple instead of a list
Help!
[['a', 1], ['b', 2]]?