I am new to Python and programming as a whole and I apologize for asking what may seem to be a duplicate question. However, I have been unable to run my own code using the following format:
C:\Users\Archangel>python hello.py
This is what hello.py contains:
# Define a function
def world():
print("Hello, World!")
I get the following response:
C:\Users\Archangel>python hello.py
File "hello.py", line 1
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
^
SyntaxError: invalid syntax
I have made sure the python file is in the C:\Users\Archangel
folder. I should mention that I have tried having and still have the file (and other files that will not run as well) in locations contained in Path such as C:\Users\Archangel\AppData\Local\Programs\Python\Python37-32
The following is what I get from print(sys.path)
>>> import sys
>>> print(sys.path)
['', 'C:\\Users\\Archangel\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip', 'C:\\Users\\Archangel\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs', 'C:\\Users\\Archangel\\AppData\\Local\\Programs\\Python\\Python37-32\\lib', 'C:\\Users\\Archangel\\AppData\\Local\\Programs\\Python\\Python37-32', 'C:\\Users\\Archangel\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']
>>>
My Google searches have been fruitless and hours of going through similar questions here on Stack Overflow have not helped. Can anyone help or point me to a question that has been answered?
UPDATE
My programs contained the following lines: Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
from the IDLE shell I used to create the files.
Deleting these lines has solved the problem. Thanks to all of you. I think this question should be deleted since the issue is elementary and clearly an error on my part.