mercredi 1 avril 2015

Random Item Generator Unexpected EOF while parsing Error Python 3.4.3

Hello I am trying to make a Generator for asteroid types, and names the finished product should make items like this:



MUS-786 A Type
AKL-675 C Type
BHF-877 B Type


Etc.


I already have the code for making the String of numbers, and Letters with the hyphen in between:



import string, random
def pick(num):
for j in range(num):
print("".join([random.choice(string.ascii_uppercase) for i in range(3)])+"-"+"".join([random.choice(string.digits) for i in range(3)]


It works great, but i am trying to put a random asteroid type in as well (A Type, B Type, C type)


Here is the final code i was using:



import string, random
def pick(num):
for j in range(num):
print("".join([random.choice(string.ascii_uppercase) for i in range(3)])+"-"+"".join([random.choice(string.digits) for i in range(3)])+" "+"".join([random.randint('A Type','B Type','C Type')])


This Gave me an error saying that there was an unexpected EOF when parsing.


What does EOF mean? What can I do to fix this?





Aucun commentaire:

Enregistrer un commentaire