Can't figure out why I cannot run these two small scripts from the command line. Pasted below is a copy of the results I get. It did work at a point in time, but I am doing something wrong that I haven't been able to dope out.
C:\Users\Dixon\mymodules>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> search4vowels('abcde')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'search4vowels' is not defined
>>> quit()
C:\Users\Dixon\mymodules>type search4vowels
The system cannot find the file specified.
C:\Users\Dixon\mymodules>dir
Volume in drive C is Windows
Volume Serial Number is 7478-065A
Directory of C:\Users\Dixon\mymodules
02/14/2020 05:40 PM <DIR> .
02/14/2020 05:40 PM <DIR> ..
02/14/2020 05:23 PM 308 vsearch.py
1 File(s) 308 bytes
2 Dir(s) 452,053,323,776 bytes free
C:\Users\Dixon\mymodules>type vsearch.py
(# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 17:13:51 2020
@author: -
"""
def search4vowels(phrase:str) -> set:
vowels = set('aeiou')
return vowels.intersection(set(phrase))
def search4letters(phrase: str, letters: str) -> set:
return set(letters).intersection(set(phrase))
C:\Users\Dixon\mymodules>
Here's what happens when I 'import' the module vsearch.py
C:\Users\Dixon\mymodules>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vsearch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Dixon\mymodules\vsearch.py", line 8
def search4vowels(phrase:str) -> set:
^
SyntaxError: invalid syntax
>>>
C:\Users\Dixon\mymodules>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> search4vowels('abcde')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'search4vowels' is not defined
>>> quit()
C:\Users\Dixon\mymodules>type search4vowels
The system cannot find the file specified.
C:\Users\Dixon\mymodules>dir
Volume in drive C is Windows
Volume Serial Number is 7478-065A
Directory of C:\Users\Dixon\mymodules
02/14/2020 05:40 PM <DIR> .
02/14/2020 05:40 PM <DIR> ..
02/14/2020 05:23 PM 308 vsearch.py
1 File(s) 308 bytes
2 Dir(s) 452,053,323,776 bytes free
C:\Users\Dixon\mymodules>type vsearch.py
(# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 17:13:51 2020
@author: -
"""
def search4vowels(phrase:str) -> set:
vowels = set('aeiou')
return vowels.intersection(set(phrase))
def search4letters(phrase: str, letters: str) -> set:
return set(letters).intersection(set(phrase))
C:\Users\Dixon\mymodules>
Here's what happens when I 'import' the module vsearch.py
C:\Users\Dixon\mymodules>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vsearch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Dixon\mymodules\vsearch.py", line 8
def search4vowels(phrase:str) -> set:
^
SyntaxError: invalid syntax
>>>