error in command prompt

hi…I installed the python 3.7…Its command worked fine with PYthon IDLE…but not in command prompt.When I write Python in cmd…it gives an error
but it is fine with Python IDLE

It might be due to older python version assuming that your default version in cmd is i guess 2.x while you are using 3.x in python idle.
Try to run by python3 filename.py instead of python filename.py in cmd.