diff --git a/count_me.py b/count_me.py index 4d5f181..45c1afe 100644 --- a/count_me.py +++ b/count_me.py @@ -15,7 +15,7 @@ def count_me(): freq_list = freq.keys() for word in freq_list: - print word, freq[word] + print (word, freq[word]) if __name__ == '__main__': diff --git a/easter_egg.py b/easter_egg.py index 4415454..d09d508 100644 --- a/easter_egg.py +++ b/easter_egg.py @@ -1,18 +1,25 @@ # Let's have some fun +import os, sys -finput = raw_input("Enter the file name: ") +finput = input("Enter the file name: ") if finput: try: - fopen = open(finput) + with open(os.path.join(sys.path[0],finput),'r') as f: + print(f.read()) + count = 0 + with open ( os.path.join ( sys.path[0] , finput ) , 'r' ) as f : + for line in f : + count += 1 + print ( 'Total number of lines is :' , count ) + except: - print 'File cannot be read:', finput + print ('File cannot be read:'), finput exit() - count = 0 - for line in fopen.read(): - count += 1 - print 'There were total ' + count + ' lines' + + + elif finput == 'na na boo boo or easter eggs': - print 'NA NA BOO BOO TO YOU, you\'ve been punked ! LOL' + print('NA NA BOO BOO TO YOU, you\'ve been punked ! LOL') diff --git a/pirate_speech.py b/pirate_speech.py index d874193..48e9805 100644 --- a/pirate_speech.py +++ b/pirate_speech.py @@ -4,12 +4,12 @@ def take_input(text): normalized = str(text) obj = requests.get('http://isithackday.com/arrpi.php?text=' + normalized) if obj.text is not None: - print obj.text + print (obj.text) else: - print "Wrong input or something" + print("Wrong input or something") if __name__ == '__main__': - take_input(raw_input()) + take_input(input()) \ No newline at end of file diff --git a/profanity_editor.py b/profanity_editor.py index 963415a..0c86455 100644 --- a/profanity_editor.py +++ b/profanity_editor.py @@ -10,11 +10,12 @@ def profanity(): def check_profanity(text): obj = requests.get('http://www.wdylike.appspot.com/?q=' + str(text)) if 'true' in obj.text: - print "Profanity alert! Check your document" + print("Profanity alert! Check your document") elif 'false' in obj.text: - print "No curse words found" + print("No curse words found") else: - print "Unable to scan the document" + print("Unable to scan the document") + if __name__ == '__main__': diff --git a/project2.py b/project2.py index db967ae..79fbaf4 100644 --- a/project2.py +++ b/project2.py @@ -2,15 +2,16 @@ import re -def strong_pass(Password): +def strong_pass(): + Password = input("Kindly enter your password") if re.match(r'([a-zA-Z0-9]).{8,}', Password) is not None: - print ('Strong Password') + print('Strong Password') else: - print ('Weak Password') - + print('Weak Password') +strong_pass() diff --git a/project3.py b/project3.py index 2b7221a..e0d6974 100644 --- a/project3.py +++ b/project3.py @@ -6,18 +6,18 @@ import re -string_in = raw_input("Enter the string") +string_in = input("Enter the string") -char_rem = raw_input("Enter the character") +char_rem = input("Enter the character") def regex_strip(string_in,char_rem): - a = re.compile(r'[%s]'%(char_rem)) - + a = re.compile(r'[%s]' % char_rem) + # sub(pattern,replace,string,max=0) - - return a.sub('',string_in) -print (regex_strip(string_in,char_rem)) + return a.sub('',string_in) + +print('The output is : ' + regex_strip (string_in, char_rem)) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ba2e194 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,210 @@ +alabaster==0.7.11 +anaconda-client==1.7.2 +anaconda-navigator==1.9.2 +anaconda-project==0.8.2 +appdirs==1.4.3 +asn1crypto==0.24.0 +astroid==2.0.4 +astropy==3.0.4 +atomicwrites==1.2.1 +attrs==18.2.0 +Automat==0.7.0 +awscli==1.16.260 +Babel==2.6.0 +backcall==0.1.0 +backports.shutil-get-terminal-size==1.0.0 +beautifulsoup4==4.6.3 +bitarray==0.8.3 +bkcharts==0.2 +blaze==0.11.3 +bleach==2.1.4 +bokeh==0.13.0 +boto==2.49.0 +boto3==1.9.250 +botocore==1.12.250 +Bottleneck==1.2.1 +certifi==2018.8.24 +cffi==1.11.5 +chardet==3.0.4 +click==6.7 +cloudpickle==0.5.5 +clyent==1.2.2 +colorama==0.3.9 +comtypes==1.1.7 +conda==4.5.11 +conda-build==3.15.1 +constantly==15.1.0 +contextlib2==0.5.5 +cryptography==2.3.1 +cycler==0.10.0 +Cython==0.28.5 +cytoolz==0.9.0.1 +dask==0.19.1 +datashape==0.5.4 +decorator==4.3.0 +defusedxml==0.5.0 +distributed==1.23.1 +docutils==0.14 +entrypoints==0.2.3 +et-xmlfile==1.0.1 +fastcache==1.0.2 +filelock==3.0.8 +Flask==1.0.2 +Flask-Cors==3.0.6 +gevent==1.3.6 +glob2==0.6 +greenlet==0.4.15 +h5py==2.8.0 +heapdict==1.0.0 +html5lib==1.0.1 +hyperlink==18.0.0 +idna==2.7 +imageio==2.4.1 +imagesize==1.1.0 +incremental==17.5.0 +ipykernel==4.10.0 +ipython==6.5.0 +ipython-genutils==0.2.0 +ipywidgets==7.4.1 +isort==4.3.4 +itsdangerous==0.24 +jdcal==1.4 +jedi==0.12.1 +Jinja2==2.10 +jmespath==0.9.4 +jsonschema==2.6.0 +jupyter==1.0.0 +jupyter-client==5.2.3 +jupyter-console==5.2.0 +jupyter-core==4.4.0 +jupyterlab==0.34.9 +jupyterlab-launcher==0.13.1 +keyring==13.2.1 +kiwisolver==1.0.1 +lazy-object-proxy==1.3.1 +llvmlite==0.24.0 +locket==0.2.0 +lxml==4.2.5 +MarkupSafe==1.0 +matplotlib==2.2.3 +mccabe==0.6.1 +menuinst==1.4.14 +mistune==0.8.3 +mkl-fft==1.0.4 +mkl-random==1.0.1 +more-itertools==4.3.0 +mpmath==1.0.0 +msgpack==0.5.6 +multipledispatch==0.6.0 +navigator-updater==0.2.1 +nbconvert==5.4.0 +nbformat==4.4.0 +networkx==2.1 +nltk==3.3 +nose==1.3.7 +notebook==5.6.0 +numba==0.39.0 +numexpr==2.6.8 +numpy==1.15.1 +numpydoc==0.8.0 +odo==0.5.1 +olefile==0.46 +openpyxl==2.5.6 +packaging==17.1 +pandas==0.23.4 +pandocfilters==1.4.2 +parso==0.3.1 +partd==0.3.8 +path.py==11.1.0 +pathlib2==2.3.2 +patsy==0.5.0 +pep8==1.7.1 +pickleshare==0.7.4 +Pillow==5.2.0 +pkginfo==1.4.2 +pluggy==0.7.1 +ply==3.11 +prometheus-client==0.3.1 +prompt-toolkit==1.0.15 +psutil==5.4.7 +py==1.6.0 +pyasn1==0.4.4 +pyasn1-modules==0.2.2 +pycodestyle==2.4.0 +pycosat==0.6.3 +pycparser==2.18 +pycrypto==2.6.1 +pycurl==7.43.0.2 +pyflakes==2.0.0 +Pygments==2.2.0 +pylint==2.1.1 +pyodbc==4.0.24 +pyOpenSSL==18.0.0 +pyparsing==2.2.0 +PySocks==1.6.8 +pytest==3.8.0 +pytest-arraydiff==0.2 +pytest-astropy==0.4.0 +pytest-doctestplus==0.1.3 +pytest-openfiles==0.3.0 +pytest-remotedata==0.3.0 +python-dateutil==2.7.3 +pytz==2018.5 +PyWavelets==1.0.0 +pywin32==223 +pywinpty==0.5.4 +PyYAML==3.13 +pyzmq==17.1.2 +QtAwesome==0.4.4 +qtconsole==4.4.1 +QtPy==1.5.0 +requests==2.19.1 +rope==0.11.0 +rsa==3.4.2 +ruamel-yaml==0.15.46 +s3transfer==0.2.1 +scikit-image==0.14.0 +scikit-learn==0.19.2 +scipy==1.1.0 +seaborn==0.9.0 +Send2Trash==1.5.0 +service-identity==17.0.0 +simplegeneric==0.8.1 +singledispatch==3.4.0.3 +six==1.11.0 +snowballstemmer==1.2.1 +sortedcollections==1.0.1 +sortedcontainers==2.0.5 +Sphinx==1.7.9 +sphinxcontrib-websupport==1.1.0 +spyder==3.3.1 +spyder-kernels==0.2.6 +SQLAlchemy==1.2.11 +statsmodels==0.9.0 +sympy==1.1.1 +tables==3.4.4 +tblib==1.3.2 +terminado==0.8.1 +testpath==0.3.1 +toolz==0.9.0 +tornado==5.1 +tqdm==4.26.0 +traitlets==4.3.2 +Twisted==18.7.0 +unicodecsv==0.14.1 +urllib3==1.23 +virtualenv==16.7.5 +wcwidth==0.1.7 +webencodings==0.5.1 +Werkzeug==0.14.1 +widgetsnbextension==3.4.1 +win-inet-pton==1.0.1 +win-unicode-console==0.5 +wincertstore==0.2 +wrapt==1.10.11 +xlrd==1.1.0 +XlsxWriter==1.1.0 +xlwings==0.11.8 +xlwt==1.3.0 +zict==0.1.3 +zope.interface==4.5.0