Skip to content
Sign upLog in
← Back to Community

unexpected eof while parsing in code

Profile icon
WilliamGosling

I'm trying to make it so that my code will randomly pick one start and one end of animal names to make a new one. However, when i run it, it comes up saying 'unexpected eof while parsing'. Can someone help? I don't know what's wrong.
Thank you,
William

Answered by CalebCarlson [earned 5 cycles]
View Answer
Voters
Profile icon
shreyan2022
Profile icon
TomGray5
Profile icon
WilliamGosling
Comments
hotnewtop
Profile icon
CalebCarlson

The last print function is also weird.
here is what you did:

print((random.choice(start_animals),(random.choice(end_animals))

you have a couple things that need to have parenthesis closed.
here is the correct syntax:

print((random.choice(start_animals)),(random.choice(end_animals)))
Profile icon
CalebCarlson

Your closing bracket for end_animals can't be indented (:
(your closing bracket was indented when it shouldn't have been)
Here is a working example:

end_animals = [ 'on', 'po', 'raffe', 'phin', 'tah', 'no', 'ena', 'el', 'ar', 'hopper', 'x' ]
Profile icon
pyelias

On line 36, you forgot to close the ( in print(.

Profile icon
CalebCarlson

nice catch, I didn't see that