Mar-04-2020, 01:26 PM
Hi I've just started trying to teach myself Python using one of the "for Dummies" books, I'me using VS Code through Anaconda running Python 3.7. I've attempted to make a Magic 8 Ball Program and I'm showing no errors in my code yet it doesn't run. It says there is a syntax error.
>>> & C:/Users/my user/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/my user/Google Drive/Python/Code Library/Magic 8 Ball.py"
File "<stdin>", line 1
& C:/Users/my users/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/my users/Google Drive/Python/Code Library/Magic 8 Ball.py"
^
SyntaxError: invalid syntax
I'm sure it's something simple and basic, however that is where my knowledge is currently. Any help would be great fully received.
import random
question = input("Ask the Magic 8 Ball a Question")
answer = random.randint(1,8)
if answer == 1:
print("Definately")
elif answer == 2:
print("Looking good")
elif answer == 3:
print("You can count on it")
elif answer == 4:
print("Ask me again leter")
elif answer == 5:
print("I'm not sure you really want ot know")
elif answer == 6:
print("I wouldn't bet money on it")
elif answer == 7:
print(" Not a chance")
elif answer == 8:
print("I've heard that's a no")
else:
print("That's not a question")
print ("The End")This is the response in terminal:>>> & C:/Users/my user/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/my user/Google Drive/Python/Code Library/Magic 8 Ball.py"
File "<stdin>", line 1
& C:/Users/my users/AppData/Local/Continuum/anaconda3/python.exe "c:/Users/my users/Google Drive/Python/Code Library/Magic 8 Ball.py"
^
SyntaxError: invalid syntax
I'm sure it's something simple and basic, however that is where my knowledge is currently. Any help would be great fully received.
