Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Useless Newbee
#1
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.

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.
Reply


Messages In This Thread
Useless Newbee - by craigpusey - Mar-04-2020, 01:26 PM
RE: Useless Newbee - by buran - Mar-04-2020, 01:45 PM
RE: Useless Newbee - by craigpusey - Mar-04-2020, 02:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  file handling Newbee question middlecope 2 893 Jan-18-2023, 03:09 PM
Last Post: middlecope
  Newbee Question chas777 4 2,349 Apr-01-2020, 06:52 PM
Last Post: chas777
  Preventing useless multiple disk writes Steffenwolt 9 4,807 Jul-28-2018, 06:39 PM
Last Post: gontajones
  Newbee - substing of column andrewjmdata 2 2,773 Feb-17-2018, 07:04 PM
Last Post: andrewjmdata

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020