From fa42dc7eec90bed41c4ea52ac7dca8fee85ded68 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Tue, 24 Mar 2020 23:55:23 +0530 Subject: [PATCH 01/33] [add] @new learn pipenv and pipfile usage --- Pipfile | 12 ++++++ Pipfile.lock | 95 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 ++--- hello.py | 10 +++++ requirements.txt | 1 + 5 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 hello.py create mode 100644 requirements.txt diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..8a9f005 --- /dev/null +++ b/Pipfile @@ -0,0 +1,12 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +Flask = "===1.1.1" + +[requires] +python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..e28f8fb --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,95 @@ +{ + "_meta": { + "hash": { + "sha256": "5a9beafa00ef0f21e319575caab812c178e578ec4a9e709c1a3c1511ecbae40c" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.8" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "click": { + "hashes": [ + "sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc", + "sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a" + ], + "version": "==7.1.1" + }, + "flask": { + "hashes": [ + "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52", + "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6" + ], + "index": "pypi", + "version": "==1.1.1" + }, + "itsdangerous": { + "hashes": [ + "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19", + "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749" + ], + "version": "==1.1.0" + }, + "jinja2": { + "hashes": [ + "sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250", + "sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49" + ], + "version": "==2.11.1" + }, + "markupsafe": { + "hashes": [ + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be" + ], + "version": "==1.1.1" + }, + "werkzeug": { + "hashes": [ + "sha256:169ba8a33788476292d04186ab33b01d6add475033dfc07215e6d219cc077096", + "sha256:6dc65cf9091cf750012f56f2cad759fa9e879f511b5ff8685e456b4e3bf90d16" + ], + "version": "==1.0.0" + } + }, + "develop": {} +} diff --git a/README.md b/README.md index c447c62..a79972b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Playground repo for Python projects -This repo has multiple branches and each branch represent different projects/proof of concepts for playing with Python technologies/frameworks. - -P.S. `master` branch is empty and has only this `README.md` file - +# Pipenv/Pipfile Understanding +- `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` +- `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` +- Once the shell is activated, run `python3 hello.py` to bring the Flask app UP!! +- By default the flask app runs on 5000 port - `http://localhost:5000/hello` diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..0a54f08 --- /dev/null +++ b/hello.py @@ -0,0 +1,10 @@ + +from flask import Flask +# set the project root directory as the static folder, you can set others. +app = Flask(__name__) + +@app.route("/hello") +def hello(): + return "Hello World!" + +app.run(debug=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3862655 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask===1.1.1 From 18a2e4d38abe5c754414b122b496b805ac0740ce Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 25 Mar 2020 11:04:10 +0530 Subject: [PATCH 02/33] [add] @update learn pipenv and pipfile usage --- Pipfile | 1 + Pipfile.lock | 9 ++++++++- README.md | 3 +++ example.pdf | Bin 0 -> 12486 bytes pdf_reader.py | 20 ++++++++++++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 example.pdf create mode 100644 pdf_reader.py diff --git a/Pipfile b/Pipfile index 8a9f005..defc7d4 100644 --- a/Pipfile +++ b/Pipfile @@ -7,6 +7,7 @@ verify_ssl = true [packages] Flask = "===1.1.1" +pypdf2 = "*" [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index e28f8fb..bc6502e 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "5a9beafa00ef0f21e319575caab812c178e578ec4a9e709c1a3c1511ecbae40c" + "sha256": "52eb69fabc11142aeeb55a8404070de9f9b99ac42460d20b32985aa8243b7f27" }, "pipfile-spec": 6, "requires": { @@ -83,6 +83,13 @@ ], "version": "==1.1.1" }, + "pypdf2": { + "hashes": [ + "sha256:e28f902f2f0a1603ea95ebe21dff311ef09be3d0f0ef29a3e44a932729564385" + ], + "index": "pypi", + "version": "==1.26.0" + }, "werkzeug": { "hashes": [ "sha256:169ba8a33788476292d04186ab33b01d6add475033dfc07215e6d219cc077096", diff --git a/README.md b/README.md index a79972b..dd61f05 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Pipenv/Pipfile Understanding +## Day 1 - `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` - `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` - Once the shell is activated, run `python3 hello.py` to bring the Flask app UP!! - By default the flask app runs on 5000 port - `http://localhost:5000/hello` +- `pipenv install PyPDF2` - installs the PyPDF2 package and updates `Pipfile` and `Pipfile.lock` files. +- Once the shell is activated, run `python3 pdf_reader.py` to read the `example.pdf` file diff --git a/example.pdf b/example.pdf new file mode 100644 index 0000000000000000000000000000000000000000..efba1fbde610227f1f45202852557e33474bf702 GIT binary patch literal 12486 zcmch71yG#Lwk=NZ;0}YkyA#~q2@E#4Gq?u`5+uRh-JJkI5}e@f8Z6l04v(Dwzqii0 z=e~NkUe$Z^^;FO9*)4nR)m_!~EgCf`85Ry!9%P!XoBU^FP5?W=$;=j6SQx;jWa9`j zb+z#USpYa*EdU26H$N|cO%7lP;N|CgHF*I>05(;?Yn$||#mVvNrSivB>mL?7KvWbN z<Y@6{IKcn!4>H$31)}Bc3<9v}X@D$W!vHy2fvo{N>;N_y8+$Ow^|iJ)1%sqO=1vx` zUVqhUrmhZdfIlEeI@!BBIJyD20c>inAPXCFu#@X+c(1Vm*mPf!-~e#GeqV8rceDU` zy*9j>Jb&4iPJmZP*Z~><HVr2y@aqu&_^tVhD1d|SALDuajoW{PhfQ7zU?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DijPk)c(JVuK$ZR{#DIx>I(L9 S1z93<a_}P4&`7JwApbAY!3Dhl literal 0 HcmV?d00001 diff --git a/pdf_reader.py b/pdf_reader.py new file mode 100644 index 0000000..9c30d97 --- /dev/null +++ b/pdf_reader.py @@ -0,0 +1,20 @@ +# importing required modules +import PyPDF2 + +# creating a pdf file object +pdfFileObj = open('example.pdf', 'rb') + +# creating a pdf reader object +pdfReader = PyPDF2.PdfFileReader(pdfFileObj) + +# printing number of pages in pdf file +print(pdfReader.numPages) + +# creating a page object +pageObj = pdfReader.getPage(0) + +# extracting text from page +print(pageObj.extractText()) + +# closing the pdf file object +pdfFileObj.close() From eff1af3642aefe5529a64dac0c373a62efa144b4 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 25 Mar 2020 19:33:41 +0530 Subject: [PATCH 03/33] @update use basics.py for learning basic syntaxes --- .idea/.gitignore | 2 ++ .idea/modules.xml | 8 ++++++++ .idea/python-playground.iml | 9 +++++++++ .idea/vcs.xml | 6 ++++++ basics.py | 3 +++ pdf_reader.py | 4 ++-- 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/python-playground.iml create mode 100644 .idea/vcs.xml create mode 100644 basics.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..570835c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/python-playground.iml" filepath="$PROJECT_DIR$/.idea/python-playground.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/python-playground.iml b/.idea/python-playground.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/python-playground.iml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/basics.py b/basics.py new file mode 100644 index 0000000..f109121 --- /dev/null +++ b/basics.py @@ -0,0 +1,3 @@ +name = input("Enter your name: ") +print("Name: ",name) +print(f"Name: {name}") diff --git a/pdf_reader.py b/pdf_reader.py index 9c30d97..5abc868 100644 --- a/pdf_reader.py +++ b/pdf_reader.py @@ -8,13 +8,13 @@ pdfReader = PyPDF2.PdfFileReader(pdfFileObj) # printing number of pages in pdf file -print(pdfReader.numPages) +print("No of pages: ", pdfReader.numPages) # creating a page object pageObj = pdfReader.getPage(0) # extracting text from page -print(pageObj.extractText()) +print("Text: ", pageObj.extractText()) # closing the pdf file object pdfFileObj.close() From adb70a4e9fb6461070433f21fe53859b61cf8a6a Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 25 Mar 2020 20:27:16 +0530 Subject: [PATCH 04/33] @update modules usage --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index dd61f05..8ce1f36 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,18 @@ - By default the flask app runs on 5000 port - `http://localhost:5000/hello` - `pipenv install PyPDF2` - installs the PyPDF2 package and updates `Pipfile` and `Pipfile.lock` files. - Once the shell is activated, run `python3 pdf_reader.py` to read the `example.pdf` file +- `basics.py` - file which includes all basic syntaxes in python +- `modules.py` + - python searches the list of directories from `sys.path`. Use `sys.path.append(directory_path)` to add directory searches during import. + ```python + python3 + Python 3.7.5 (default, Nov 1 2019, 02:16:32) + [Clang 11.0.0 (clang-1100.0.33.8)] on darwin + Type "help", "copyright", "credits" or "license" for more information. + >>> import sys + >>> sys.path + ['', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages'] + ``` + - Alternatively use `PYTHONPATH` to set the package/module import paths. + - If a package has `__init__.py`, it becomes a module + - `learn` is a module which is used in `modules.py` \ No newline at end of file From 24a764fae3b79ec38f04c43d1ad6c35e3c51dc08 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 25 Mar 2020 20:27:37 +0530 Subject: [PATCH 05/33] @update modules usage --- learn/__init__.py | 2 ++ learn/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 190 bytes learn/__pycache__/learn.cpython-37.pyc | Bin 0 -> 524 bytes learn/learn.py | 6 ++++++ modules.py | 4 ++++ 5 files changed, 12 insertions(+) create mode 100644 learn/__init__.py create mode 100644 learn/__pycache__/__init__.cpython-37.pyc create mode 100644 learn/__pycache__/learn.cpython-37.pyc create mode 100644 learn/learn.py create mode 100644 modules.py diff --git a/learn/__init__.py b/learn/__init__.py new file mode 100644 index 0000000..2c9f264 --- /dev/null +++ b/learn/__init__.py @@ -0,0 +1,2 @@ +from learn.learn import Learn +# This will simplify import as learn than learn.learn for consumer diff --git a/learn/__pycache__/__init__.cpython-37.pyc b/learn/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e2b0baa39d5584854a650632aff0448eadbf14a GIT binary patch literal 190 zcmZ?b<>g`kf@?X|afv|sF^B^LOhASM5Elyoi4=wu#vF!R#wbQch7_h?22JLdKv4!w z##^jDsfk5-ews{C+&LhY9+)fw>0ZfD#0;ds#4kJj(BjmhV*SLd#7cda{N&Qy)Vz{n z{p9?VRQ-a=l8pR3-GZFN%JicA(!3OXup#>K@tJv<CGqik1(mlrY;yBcN^?@}7=cE9 H24V&P$KWth literal 0 HcmV?d00001 diff --git a/learn/__pycache__/learn.cpython-37.pyc b/learn/__pycache__/learn.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..062fe9d5b56eb4472af3a17e8bbf1f8af10c3bf1 GIT binary patch literal 524 zcmY*Vy-ve05I*OpM1?Xi^8y)Y9sq<YKw?2%P?ro?R%~di{9z{&fo$|;n0XtoJOUdN zcaBoQN#A|vv+ur7zM9RZfbm(pJs9LKI*j3Cu|Sv;Ot&CGvK`{xOF??~5c?VS_u*l+ zK$ufZ3Q{H^^(2$t4pLwGGC&Swh;tJg-YKEWj7BJk3D*cietOmeM?rkdmNBzIqh6ZW zvw>0hqo$`HpaZ0z^JHa|Hi_7ZF1e|)woqkblB|*{sk>%fm1lJ>x+h(=rA%^?9rC>H zY{dDd+%%liMnehM>#_4TAFnb-Z46?9GdaPchwW(4S&EsaA9KEj6yni_W-YX$a#T1R z6kLB9hh(D^h2q>!IWH>N=2RbX{@jXuxX~o25B{&G574w&kKPQmA{P0sgFol^kE8vF NjV=bIOPc*gz%O&kXM+F$ literal 0 HcmV?d00001 diff --git a/learn/learn.py b/learn/learn.py new file mode 100644 index 0000000..c1c51c0 --- /dev/null +++ b/learn/learn.py @@ -0,0 +1,6 @@ +class Learn: + def __init__(self, text): + self.text = text + + def share(self): + return self.text diff --git a/modules.py b/modules.py new file mode 100644 index 0000000..532a216 --- /dev/null +++ b/modules.py @@ -0,0 +1,4 @@ +import learn + +l = learn.Learn("This is a learning program") +print(l.share()) \ No newline at end of file From a7ace7cec9bc4306ff17968d681987d1d6c1bff5 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sat, 28 Mar 2020 20:16:57 +0530 Subject: [PATCH 06/33] @update tuples usage --- README.md | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index abb19c7..951a70b 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,3 @@ -# Playground repo for Python projects -This repo has multiple branches and each branch represent different projects/proof of concepts for playing with Python technologies/frameworks. +# Tuples -_P.S. `master` branch is empty and has only this `README.md` file_ - -## Table of Contents -- [Contents in other branches](#contents-in-other-branches) -- [Installation](#installation) - -## Contents in other branches -- [learn/pipenv-pipfile - Pipenv and Pipfile](https://github.com/TechPrimers/python-playground/tree/learn/pipenv-pipfile) - - Day 1 - - Started with `pipenv` usage - - Added custom package installation - PyPDF2 for reading PDF - - Created `learn` module and used in `modules.py` -- [learn/functions - Functions](https://github.com/TechPrimers/python-playground/tree/learn/functions) - - Day 2 - - Started using callable functions inside a class - - Day 3 - - Started using Functions and String manipulation -- [learn/tuples - Tuples](https://github.com/TechPrimers/python-playground/tree/learn/tuples) - - Day 4 - - Started using `tuples` - -## Installation -Command used in Mac for installing supporting tools -- Python3 - `brew install python3` -- Pipenv - `brew install pipenv` +## Day 4 From 3f4ad85325b78ffd2bc4427e6a653f5866817175 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sat, 28 Mar 2020 20:17:36 +0530 Subject: [PATCH 07/33] @update tuples usage --- tuples.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tuples.py diff --git a/tuples.py b/tuples.py new file mode 100644 index 0000000..5e272cd --- /dev/null +++ b/tuples.py @@ -0,0 +1,38 @@ +tuple_variable = () +print("Empty tuple: ", tuple_variable) + +single_tuple = ("single",) +print("Single tuple: ", single_tuple) +print("Single tuple(type): ", type(single_tuple)) + + +str_tuple = ("single") # Without comma, tuples become str +print("Not a tuple: ", str_tuple) +print("Not a tuple(type): ", type(str_tuple)) + + +declar_tuple = ("one", "two", "three") +print("Declaring tuples: ", declar_tuple) + +declar_tuple = "one", "two", "three" # Another way of declaring tuples +print("Declaring tuples: ", declar_tuple) + +assign_tuple1, assign_tuple2, assign_tuple3 = ("one", "two", "three") +print("Assigned tuple1: ", assign_tuple1) +print("Assigned tuple2: ", assign_tuple2) +print("Assigned tuple3: ", assign_tuple3) + +#Flip variables using tuples without using a temporary variable +assign_tuple1, assign_tuple2 = assign_tuple2, assign_tuple1 +print("Swapped tuple1: ", assign_tuple1) +print("Swapped tuple2: ", assign_tuple2) + +#List to tuple +list_tuple = tuple(["one", "two", "three"]) +print("List tuple: ", list_tuple) +print("List tuple(type): ", type(list_tuple)) + +for tup in list_tuple: + print("items: ", tup) + +print("List: ", list("test")) \ No newline at end of file From 82cb52546945de1c4d1a15ed2ae9dd3b65e13bf1 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sun, 29 Mar 2020 20:03:14 +0530 Subject: [PATCH 08/33] @add dictionaries usage --- README.md | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 3f65862..e7ff545 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,4 @@ -# Playground repo for Python projects -This repo has multiple branches and each branch represent different projects/proof of concepts for playing with Python technologies/frameworks. +# Dictionaries -_P.S. `master` branch is empty and has only this `README.md` file_ - -## Table of Contents -- [Contents in other branches](#contents-in-other-branches) -- [Installation](#installation) - -## Contents in other branches -- [learn/pipenv-pipfile - Pipenv and Pipfile](https://github.com/TechPrimers/python-playground/tree/learn/pipenv-pipfile) - - Day 1 - - Started with `pipenv` usage - - Added custom package installation - PyPDF2 for reading PDF - - Created `learn` module and used in `modules.py` -- [learn/functions - Functions](https://github.com/TechPrimers/python-playground/tree/learn/functions) - - Day 2 - - Started using callable functions inside a class - - Day 3 - - Started using Functions and String manipulation -- [learn/tuples - Tuples](https://github.com/TechPrimers/python-playground/tree/learn/tuples) - - Day 4 - - Started using `tuples` - -## Installation -Command used in Mac for installing supporting tools -- Python3 - `brew install python3` -- Pipenv - `brew install pipenv` - -## Resources -- [Introducing Python - Oreilly](https://learning.oreilly.com/library/view/introducing-python-2nd) \ No newline at end of file +## Day 5 +- Started using dictionaries \ No newline at end of file From dacca40bc7341adeb8987f7c3bd711b636839938 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sun, 29 Mar 2020 20:03:56 +0530 Subject: [PATCH 09/33] @add dictionaries usage --- dictionaries.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dictionaries.py diff --git a/dictionaries.py b/dictionaries.py new file mode 100644 index 0000000..ceca68c --- /dev/null +++ b/dictionaries.py @@ -0,0 +1,22 @@ +# Order doesn't matter like HashMap +dictionary = {"name": "ajay", "location": "chennai"} + +for item in dictionary: + print(f"key[{item}] value [{dictionary[item]}]in dictionary") + print(f"Another representation: key[{item}] value [{dictionary.get(item)}]in dictionary") + +print("Only keys: ", dictionary.keys()) + +dictionary_keys = list(dictionary.keys()) +print("Keys: ", dictionary_keys) +print("Keys (type): ", type(dictionary_keys)) + + +dictionary_values = list(dictionary.values()) +print("Values: ", dictionary_values) +print("Values (type): ", type(dictionary_values)) + + +dictionary_list_items = list(dictionary.items()) +print("Items: ", dictionary_list_items) +print("Items (type): ", type(dictionary_list_items)) \ No newline at end of file From 55142d9c604cbc6f35198481d81af575af04529e Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sun, 29 Mar 2020 20:31:45 +0530 Subject: [PATCH 10/33] @add sets usage --- README.md | 3 ++- sets.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 sets.py diff --git a/README.md b/README.md index e7ff545..0b311c4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Dictionaries ## Day 5 -- Started using dictionaries \ No newline at end of file +- Started using dictionaries +- Started using sets \ No newline at end of file diff --git a/sets.py b/sets.py new file mode 100644 index 0000000..fc305d4 --- /dev/null +++ b/sets.py @@ -0,0 +1,12 @@ +# Set has similar notation to dictionaries with {} however they have only keys +# elements in a set are unique compared to lists +sets = {"z","a", "b", "c"} +print("Type: ", type(sets)) +print("Pop: ", sets.pop()) +print("Sorted Set(list): ", sorted(sets)) + +list_var = ["a", "a", "z", "d", "c", "z"] +print("Sorted List: ", sorted(list_var)) +print("Sorted in reverse: ", sorted(list_var, reverse = True)) + +print("Remove duplicates from list: ", sorted(list(set(list_var)))) From 57e485319e418cde1c0b84a98573acb13c1fccc5 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 11:03:17 +0530 Subject: [PATCH 11/33] merge branches --- README.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 0b311c4..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Dictionaries - -## Day 5 -- Started using dictionaries -- Started using sets \ No newline at end of file From 87a26a72bad6fdd1cfdcb1ed1687d362f192edfa Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 11:03:46 +0530 Subject: [PATCH 12/33] merge branches --- README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 951a70b..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Tuples - -## Day 4 From 3fc8eb3b2895d7894d3bfd6c55782003bc193f99 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 11:08:19 +0530 Subject: [PATCH 13/33] merge branches --- README.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 8ce1f36..0000000 --- a/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Pipenv/Pipfile Understanding -## Day 1 -- `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` -- `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` -- Once the shell is activated, run `python3 hello.py` to bring the Flask app UP!! -- By default the flask app runs on 5000 port - `http://localhost:5000/hello` -- `pipenv install PyPDF2` - installs the PyPDF2 package and updates `Pipfile` and `Pipfile.lock` files. -- Once the shell is activated, run `python3 pdf_reader.py` to read the `example.pdf` file -- `basics.py` - file which includes all basic syntaxes in python -- `modules.py` - - python searches the list of directories from `sys.path`. Use `sys.path.append(directory_path)` to add directory searches during import. - ```python - python3 - Python 3.7.5 (default, Nov 1 2019, 02:16:32) - [Clang 11.0.0 (clang-1100.0.33.8)] on darwin - Type "help", "copyright", "credits" or "license" for more information. - >>> import sys - >>> sys.path - ['', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages'] - ``` - - Alternatively use `PYTHONPATH` to set the package/module import paths. - - If a package has `__init__.py`, it becomes a module - - `learn` is a module which is used in `modules.py` \ No newline at end of file From 2b1915e5d8350c11bad21d0110875ca50eaefa18 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 11:34:09 +0530 Subject: [PATCH 14/33] merge branches --- README.md | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b6bbd52..b252db4 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,18 @@ _P.S. `master` branch is empty and has only this `README.md` file_ ## Table of Contents - [Status Updates](#status-updates) + - [Day 1](#day-1) + - [Day 2](#day-2) + - [Day 3](#day-3) + - [Day 4](#day-4) + - [Day 5](#day-5) + - [Day 6](#day-6) - [Installation](#installation) - [Resources](#resources) ## Status Updates -- [learn/pipenv-pipfile - Pipenv and Pipfile](https://github.com/TechPrimers/python-playground/tree/learn/pipenv-pipfile) - - Day 1 - March 25th, 2020 - ## Day 1 +From March 25th, 2020 +### Day 1 - `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` - `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` - Once the shell is activated, run `python3 hello.py` to bring the Flask app UP!! @@ -34,19 +39,21 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - If a package has `__init__.py`, it becomes a module - `learn` is a module which is used in `modules.py` +### Day 2 + - Started using callable functions inside a class + +### Day 3 + - Started using Functions and String manipulation + +### Day 4 + - Started using `tuples` + +### Day 5 + - Started using `dictionaries` + - Started using `set` + +### Day 6 -- [learn/functions - Functions](https://github.com/TechPrimers/python-playground/tree/learn/functions) - - Day 2 - - Started using callable functions inside a class - - Day 3 - - Started using Functions and String manipulation -- [learn/tuples - Tuples](https://github.com/TechPrimers/python-playground/tree/learn/tuples) - - Day 4 - - Started using `tuples` -- [learn/dictionaries - Dictionaries](https://github.com/TechPrimers/python-playground/tree/learn/dictionaries) - - Day 5 - - Started using `dictionaries` - - Started using `set` ## Installation Command used in Mac for installing supporting tools From 19627ece0c1ae9c3d759518dd236e9ba624f7364 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 11:34:19 +0530 Subject: [PATCH 15/33] merge branches --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b252db4..bf59807 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ ## Status Updates From March 25th, 2020 + ### Day 1 - `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` - `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` From db1adab353284c5351a8fa00e0ccd3138a6e31c1 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 30 Mar 2020 14:09:59 +0530 Subject: [PATCH 16/33] @update tidy up folder structures --- README.md | 4 ++++ dictionaries.py => dictionaries/dictionaries.py | 0 sets.py => dictionaries/sets.py | 0 functions.py => functions/functions.py | 0 functions_main.py => functions/functions_main.py | 0 strings.py => functions/strings.py | 0 learn/__pycache__/__init__.cpython-37.pyc | Bin 190 -> 0 bytes learn/__pycache__/learn.cpython-37.pyc | Bin 524 -> 0 bytes Pipfile => pipenv/Pipfile | 0 Pipfile.lock => pipenv/Pipfile.lock | 0 basics.py => pipenv/basics.py | 0 example.pdf => pipenv/example.pdf | Bin hello.py => pipenv/hello.py | 0 {learn => pipenv/learn}/__init__.py | 0 {learn => pipenv/learn}/learn.py | 0 modules.py => pipenv/modules.py | 0 pdf_reader.py => pipenv/pdf_reader.py | 0 requirements.txt => pipenv/requirements.txt | 0 tuples.py => tuples/tuples.py | 0 19 files changed, 4 insertions(+) rename dictionaries.py => dictionaries/dictionaries.py (100%) rename sets.py => dictionaries/sets.py (100%) rename functions.py => functions/functions.py (100%) rename functions_main.py => functions/functions_main.py (100%) rename strings.py => functions/strings.py (100%) delete mode 100644 learn/__pycache__/__init__.cpython-37.pyc delete mode 100644 learn/__pycache__/learn.cpython-37.pyc rename Pipfile => pipenv/Pipfile (100%) rename Pipfile.lock => pipenv/Pipfile.lock (100%) rename basics.py => pipenv/basics.py (100%) rename example.pdf => pipenv/example.pdf (100%) rename hello.py => pipenv/hello.py (100%) rename {learn => pipenv/learn}/__init__.py (100%) rename {learn => pipenv/learn}/learn.py (100%) rename modules.py => pipenv/modules.py (100%) rename pdf_reader.py => pipenv/pdf_reader.py (100%) rename requirements.txt => pipenv/requirements.txt (100%) rename tuples.py => tuples/tuples.py (100%) diff --git a/README.md b/README.md index bf59807..eb99306 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ From March 25th, 2020 ### Day 1 +- `cd pipenv` - `pipenv install` - Similar to `npm install`. Creates 2 files `Pipfile` and `Pipfile.lock` similar to `package-lock.json` in the javascript world with dependencies based on `requirements.txt` - `pipenv shell` - Activates the virtual environment. Much simpler than `virtualenv` - Once the shell is activated, run `python3 hello.py` to bring the Flask app UP!! @@ -41,15 +42,18 @@ From March 25th, 2020 - `learn` is a module which is used in `modules.py` ### Day 2 + - cd `functions` - Started using callable functions inside a class ### Day 3 - Started using Functions and String manipulation ### Day 4 + - `cd tuples` - Started using `tuples` ### Day 5 + - `cd dictionaries` - Started using `dictionaries` - Started using `set` diff --git a/dictionaries.py b/dictionaries/dictionaries.py similarity index 100% rename from dictionaries.py rename to dictionaries/dictionaries.py diff --git a/sets.py b/dictionaries/sets.py similarity index 100% rename from sets.py rename to dictionaries/sets.py diff --git a/functions.py b/functions/functions.py similarity index 100% rename from functions.py rename to functions/functions.py diff --git a/functions_main.py b/functions/functions_main.py similarity index 100% rename from functions_main.py rename to functions/functions_main.py diff --git a/strings.py b/functions/strings.py similarity index 100% rename from strings.py rename to functions/strings.py diff --git a/learn/__pycache__/__init__.cpython-37.pyc b/learn/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 4e2b0baa39d5584854a650632aff0448eadbf14a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 190 zcmZ?b<>g`kf@?X|afv|sF^B^LOhASM5Elyoi4=wu#vF!R#wbQch7_h?22JLdKv4!w z##^jDsfk5-ews{C+&LhY9+)fw>0ZfD#0;ds#4kJj(BjmhV*SLd#7cda{N&Qy)Vz{n z{p9?VRQ-a=l8pR3-GZFN%JicA(!3OXup#>K@tJv<CGqik1(mlrY;yBcN^?@}7=cE9 H24V&P$KWth diff --git a/learn/__pycache__/learn.cpython-37.pyc b/learn/__pycache__/learn.cpython-37.pyc deleted file mode 100644 index 062fe9d5b56eb4472af3a17e8bbf1f8af10c3bf1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmY*Vy-ve05I*OpM1?Xi^8y)Y9sq<YKw?2%P?ro?R%~di{9z{&fo$|;n0XtoJOUdN zcaBoQN#A|vv+ur7zM9RZfbm(pJs9LKI*j3Cu|Sv;Ot&CGvK`{xOF??~5c?VS_u*l+ zK$ufZ3Q{H^^(2$t4pLwGGC&Swh;tJg-YKEWj7BJk3D*cietOmeM?rkdmNBzIqh6ZW zvw>0hqo$`HpaZ0z^JHa|Hi_7ZF1e|)woqkblB|*{sk>%fm1lJ>x+h(=rA%^?9rC>H zY{dDd+%%liMnehM>#_4TAFnb-Z46?9GdaPchwW(4S&EsaA9KEj6yni_W-YX$a#T1R z6kLB9hh(D^h2q>!IWH>N=2RbX{@jXuxX~o25B{&G574w&kKPQmA{P0sgFol^kE8vF NjV=bIOPc*gz%O&kXM+F$ diff --git a/Pipfile b/pipenv/Pipfile similarity index 100% rename from Pipfile rename to pipenv/Pipfile diff --git a/Pipfile.lock b/pipenv/Pipfile.lock similarity index 100% rename from Pipfile.lock rename to pipenv/Pipfile.lock diff --git a/basics.py b/pipenv/basics.py similarity index 100% rename from basics.py rename to pipenv/basics.py diff --git a/example.pdf b/pipenv/example.pdf similarity index 100% rename from example.pdf rename to pipenv/example.pdf diff --git a/hello.py b/pipenv/hello.py similarity index 100% rename from hello.py rename to pipenv/hello.py diff --git a/learn/__init__.py b/pipenv/learn/__init__.py similarity index 100% rename from learn/__init__.py rename to pipenv/learn/__init__.py diff --git a/learn/learn.py b/pipenv/learn/learn.py similarity index 100% rename from learn/learn.py rename to pipenv/learn/learn.py diff --git a/modules.py b/pipenv/modules.py similarity index 100% rename from modules.py rename to pipenv/modules.py diff --git a/pdf_reader.py b/pipenv/pdf_reader.py similarity index 100% rename from pdf_reader.py rename to pipenv/pdf_reader.py diff --git a/requirements.txt b/pipenv/requirements.txt similarity index 100% rename from requirements.txt rename to pipenv/requirements.txt diff --git a/tuples.py b/tuples/tuples.py similarity index 100% rename from tuples.py rename to tuples/tuples.py From 013074f1d0d6eb3a9bc8667036afdedf117d960c Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Tue, 31 Mar 2020 12:33:06 +0530 Subject: [PATCH 17/33] @update add resource --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index eb99306..9c0779d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ From March 25th, 2020 ### Day 6 +### Day 7 + ## Installation Command used in Mac for installing supporting tools @@ -67,3 +69,4 @@ Command used in Mac for installing supporting tools ## Resources - [Introducing Python - Oreilly](https://learning.oreilly.com/library/view/introducing-python-2nd) - Most exhaustive and amazing book..! +- [Projects to build after learning pythong](https://medium.com/javarevisited/8-projects-you-can-buil-to-learn-python-in-2020-251dd5350d56) \ No newline at end of file From 0fd98803bc445118ceeb86ef713f824376f94ca4 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Tue, 31 Mar 2020 13:06:31 +0530 Subject: [PATCH 18/33] @add day 6 updates --- README.md | 4 +++- classes/User.py | 13 +++++++++++++ classes/UserAnnotation.py | 13 +++++++++++++ classes/class_main.py | 17 +++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 classes/User.py create mode 100644 classes/UserAnnotation.py create mode 100644 classes/class_main.py diff --git a/README.md b/README.md index 9c0779d..afcd2ea 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Day 4](#day-4) - [Day 5](#day-5) - [Day 6](#day-6) + - [Day 7](#day-7) - [Installation](#installation) - [Resources](#resources) @@ -58,7 +59,8 @@ From March 25th, 2020 - Started using `set` ### Day 6 - + - Started with class usage and best practices + ### Day 7 diff --git a/classes/User.py b/classes/User.py new file mode 100644 index 0000000..1d6fb16 --- /dev/null +++ b/classes/User.py @@ -0,0 +1,13 @@ +class User() : + + def __init__(self, input_name): + self.private_name = input_name + + def get_name(self): + return self.private_name; + + def set_name(self, input_name): + self.private_name = input_name + + name = property(get_name, set_name) + diff --git a/classes/UserAnnotation.py b/classes/UserAnnotation.py new file mode 100644 index 0000000..974a14e --- /dev/null +++ b/classes/UserAnnotation.py @@ -0,0 +1,13 @@ +class UserAnnotation() : + + def __init__(self, input_name): + self.private_name = input_name + + @property + def name(self): + return self.private_name; + + @name.setter + def name(self, input_name): + self.private_name = input_name + diff --git a/classes/class_main.py b/classes/class_main.py new file mode 100644 index 0000000..9e87450 --- /dev/null +++ b/classes/class_main.py @@ -0,0 +1,17 @@ +from User import User +from UserAnnotation import UserAnnotation + +user = User("ajay") +user_annotation = UserAnnotation("ajay") +print(user.get_name()) +user.set_name("raj") + +print(user.private_name) +# Since property() is set via name. we can use name instead of private_name +user.name = "jaga" +print(user.name) +print("User annotation:") +print(user_annotation.private_name) +print(user_annotation.name) +user_annotation.name = "jaga" +print(user_annotation.name) \ No newline at end of file From b1d7634a87abc2008e52854652a8813d7ec82a8e Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Tue, 31 Mar 2020 14:07:21 +0530 Subject: [PATCH 19/33] @add day 7 updates --- README.md | 3 ++- classes/ClassMethod.py | 15 +++++++++++++++ classes/User.py | 2 +- classes/UserAnnotation.py | 2 +- classes/class_main.py | 12 +++++++++++- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 classes/ClassMethod.py diff --git a/README.md b/README.md index afcd2ea..69582c5 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ From March 25th, 2020 - Started with class usage and best practices ### Day 7 - + - class methods + - static methods ## Installation Command used in Mac for installing supporting tools diff --git a/classes/ClassMethod.py b/classes/ClassMethod.py new file mode 100644 index 0000000..f9e30d5 --- /dev/null +++ b/classes/ClassMethod.py @@ -0,0 +1,15 @@ +class ClassMethod: + count = 0 + def __init__(self): + ClassMethod.count += 1 + + @classmethod + def print(cls): + print(f"Number of objects: {cls.count}") + + @staticmethod + def printLog(): + print("Static Method: ", ClassMethod.count) + + def normal(self): + print("normal") \ No newline at end of file diff --git a/classes/User.py b/classes/User.py index 1d6fb16..ffccd98 100644 --- a/classes/User.py +++ b/classes/User.py @@ -1,4 +1,4 @@ -class User() : +class User: def __init__(self, input_name): self.private_name = input_name diff --git a/classes/UserAnnotation.py b/classes/UserAnnotation.py index 974a14e..c9d83c4 100644 --- a/classes/UserAnnotation.py +++ b/classes/UserAnnotation.py @@ -1,4 +1,4 @@ -class UserAnnotation() : +class UserAnnotation: def __init__(self, input_name): self.private_name = input_name diff --git a/classes/class_main.py b/classes/class_main.py index 9e87450..73efab2 100644 --- a/classes/class_main.py +++ b/classes/class_main.py @@ -1,5 +1,6 @@ from User import User from UserAnnotation import UserAnnotation +from ClassMethod import ClassMethod user = User("ajay") user_annotation = UserAnnotation("ajay") @@ -14,4 +15,13 @@ print(user_annotation.private_name) print(user_annotation.name) user_annotation.name = "jaga" -print(user_annotation.name) \ No newline at end of file +print(user_annotation.name) + +ClassMethod.printLog() + +cm = ClassMethod() +cm_a = ClassMethod() +cm_b = ClassMethod() +cm.print() +cm.normal() +ClassMethod.printLog() \ No newline at end of file From 1f505243e0fdd888d1c87dae83c9f4acbf2bd7e2 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 1 Apr 2020 22:59:07 +0530 Subject: [PATCH 20/33] @add day 8 updates --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69582c5..4235980 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Day 5](#day-5) - [Day 6](#day-6) - [Day 7](#day-7) + - [Day 8](#day-8) - [Installation](#installation) - [Resources](#resources) @@ -65,6 +66,9 @@ From March 25th, 2020 - class methods - static methods +### Day 8 + - class equals + ## Installation Command used in Mac for installing supporting tools - Python3 - `brew install python3` @@ -72,4 +76,4 @@ Command used in Mac for installing supporting tools ## Resources - [Introducing Python - Oreilly](https://learning.oreilly.com/library/view/introducing-python-2nd) - Most exhaustive and amazing book..! -- [Projects to build after learning pythong](https://medium.com/javarevisited/8-projects-you-can-buil-to-learn-python-in-2020-251dd5350d56) \ No newline at end of file +- [Projects to build after learning pythong](https://medium.com/javarevisited/8-projects-you-can-buil-to-learn-python-in-2020-251dd5350d56) From e6358eb9ed197ba459ab92740e2aa51853185e28 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 1 Apr 2020 23:03:58 +0530 Subject: [PATCH 21/33] @add day 8 updates --- classes/Word.py | 7 +++++++ classes/word_main.py | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 classes/Word.py create mode 100644 classes/word_main.py diff --git a/classes/Word.py b/classes/Word.py new file mode 100644 index 0000000..461a1f0 --- /dev/null +++ b/classes/Word.py @@ -0,0 +1,7 @@ +class Word: + + def __init__(self, text): + self.text = text + + def __eq__(self, new_word): + return self.text.lower() == new_word.text.lower() diff --git a/classes/word_main.py b/classes/word_main.py new file mode 100644 index 0000000..3dc2ee7 --- /dev/null +++ b/classes/word_main.py @@ -0,0 +1,8 @@ +from Word import Word + +word_a = Word("a") +word_b = Word("b") +word_c = Word("b") + +print("A equals B: ", word_a == word_b) +print("B equals C: ", word_b == word_c) \ No newline at end of file From c15bffa8bb68a000bd879f770201549bf69b7005 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 1 Apr 2020 23:05:56 +0530 Subject: [PATCH 22/33] @add day 8 updates --- classes/Word.py | 3 +++ classes/word_main.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/Word.py b/classes/Word.py index 461a1f0..59ae6c2 100644 --- a/classes/Word.py +++ b/classes/Word.py @@ -5,3 +5,6 @@ def __init__(self, text): def __eq__(self, new_word): return self.text.lower() == new_word.text.lower() + + def __repr__(self): + return f"(Word: {self.text})" \ No newline at end of file diff --git a/classes/word_main.py b/classes/word_main.py index 3dc2ee7..8650fac 100644 --- a/classes/word_main.py +++ b/classes/word_main.py @@ -5,4 +5,5 @@ word_c = Word("b") print("A equals B: ", word_a == word_b) -print("B equals C: ", word_b == word_c) \ No newline at end of file +print("B equals C: ", word_b == word_c) +print("A: ", word_a) \ No newline at end of file From 2467024e422862c8c7136d9864670b01977f25f2 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 1 Apr 2020 23:11:58 +0530 Subject: [PATCH 23/33] @add day 8 updates --- classes/DataClass.py | 6 ++++++ classes/dataclass_main.py | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 classes/DataClass.py create mode 100644 classes/dataclass_main.py diff --git a/classes/DataClass.py b/classes/DataClass.py new file mode 100644 index 0000000..2ff49af --- /dev/null +++ b/classes/DataClass.py @@ -0,0 +1,6 @@ +from dataclasses import dataclass + +@dataclass +class DataClass: + name: str + age: int = 0 \ No newline at end of file diff --git a/classes/dataclass_main.py b/classes/dataclass_main.py new file mode 100644 index 0000000..faff4be --- /dev/null +++ b/classes/dataclass_main.py @@ -0,0 +1,6 @@ +from DataClass import DataClass + +data_class = DataClass("ajay", 19) + +print("Name: ", data_class.name) +print("Age: ", data_class.age) \ No newline at end of file From df7898dc33f36448b6a8a389bc44de67a9e40722 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Wed, 1 Apr 2020 23:12:27 +0530 Subject: [PATCH 24/33] @add day 8 updates --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4235980..6d2e533 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ From March 25th, 2020 - static methods ### Day 8 - - class equals + - class equals and repr + - Data Class usage ## Installation Command used in Mac for installing supporting tools From b6d9c0ef957a480353521f2009ea65588f737197 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Fri, 3 Apr 2020 22:00:07 +0530 Subject: [PATCH 25/33] @update: day 10 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6d2e533..e4c4f3e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Day 6](#day-6) - [Day 7](#day-7) - [Day 8](#day-8) + - [Day 10](#day-10) - [Installation](#installation) - [Resources](#resources) @@ -69,6 +70,9 @@ From March 25th, 2020 ### Day 8 - class equals and repr - Data Class usage + +### Day 10 + - Files and Directories ## Installation Command used in Mac for installing supporting tools From 47e0d8d1fa8d33581fec396991528d693ab65112 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Fri, 3 Apr 2020 22:05:42 +0530 Subject: [PATCH 26/33] @update: day 10 --- files/files.py | 10 ++++++++++ files/files.txt | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 files/files.py create mode 100644 files/files.txt diff --git a/files/files.py b/files/files.py new file mode 100644 index 0000000..b541f03 --- /dev/null +++ b/files/files.py @@ -0,0 +1,10 @@ +file_obj = open("files.txt", "wt") +print("This is a temp file ", file=file_obj) +file_obj.write("Second line") +file_obj.close() + +try: + fout = open('files.txt', 'xt') + fout.write('added') +except FileExistsError: + print('files.txt already exists!') \ No newline at end of file diff --git a/files/files.txt b/files/files.txt new file mode 100644 index 0000000..27652c6 --- /dev/null +++ b/files/files.txt @@ -0,0 +1,2 @@ +This is a temp file +Second line \ No newline at end of file From 1fd9b5e1d2a072d565775d067153e22559694b05 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Fri, 3 Apr 2020 22:16:15 +0530 Subject: [PATCH 27/33] @update: day 10 --- files/files.py | 19 +++++++++++++++++-- files/files.txt | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/files/files.py b/files/files.py index b541f03..21dcf32 100644 --- a/files/files.py +++ b/files/files.py @@ -1,5 +1,5 @@ file_obj = open("files.txt", "wt") -print("This is a temp file ", file=file_obj) +print("This is a temp file", file=file_obj) file_obj.write("Second line") file_obj.close() @@ -7,4 +7,19 @@ fout = open('files.txt', 'xt') fout.write('added') except FileExistsError: - print('files.txt already exists!') \ No newline at end of file + print('files.txt already exists!') + +file_obj = open('files.txt', 'rt') +while True: + line = file_obj.readline(); + if not line: + break; + print("Line: ", line) +file_obj.close() + +file_obj = open('files.txt', 'rt') +lines = file_obj.readlines(); +print("Lines: ", lines) +file_obj.close() +for line in lines: + print("Line...", line) \ No newline at end of file diff --git a/files/files.txt b/files/files.txt index 27652c6..6c3bf22 100644 --- a/files/files.txt +++ b/files/files.txt @@ -1,2 +1,2 @@ -This is a temp file +This is a temp file Second line \ No newline at end of file From 41b78607a62e83d7d35ee0e96f84bee3594dc6b9 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Fri, 3 Apr 2020 22:19:25 +0530 Subject: [PATCH 28/33] @update: day 10 --- files/files.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/files/files.py b/files/files.py index 21dcf32..a955a4f 100644 --- a/files/files.py +++ b/files/files.py @@ -1,3 +1,5 @@ +import os + file_obj = open("files.txt", "wt") print("This is a temp file", file=file_obj) file_obj.write("Second line") @@ -22,4 +24,8 @@ print("Lines: ", lines) file_obj.close() for line in lines: - print("Line...", line) \ No newline at end of file + print("Line...", line) + +print(os.path.isfile('files.txt')) +print(os.path.isfile('files.temp')) +print(os.path.exists('files.txt')) \ No newline at end of file From 05503b6ccc24311e11897ee070bcaa6a2b147f67 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Sun, 5 Apr 2020 11:55:02 +0530 Subject: [PATCH 29/33] @add: lambda usage --- README.md | 4 ++++ lambda/lambda_main.py | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 lambda/lambda_main.py diff --git a/README.md b/README.md index e4c4f3e..8932926 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Day 7](#day-7) - [Day 8](#day-8) - [Day 10](#day-10) + - [Day 12](#day-12) - [Installation](#installation) - [Resources](#resources) @@ -74,6 +75,9 @@ From March 25th, 2020 ### Day 10 - Files and Directories +### Day 12 + - Lambda + ## Installation Command used in Mac for installing supporting tools - Python3 - `brew install python3` diff --git a/lambda/lambda_main.py b/lambda/lambda_main.py new file mode 100644 index 0000000..cbd9216 --- /dev/null +++ b/lambda/lambda_main.py @@ -0,0 +1,2 @@ +name_lambda = lambda name: name.split()[-1] +print("Name: ", name_lambda("ajay")) From 3be45720767cf28428139edf6984132179f99e4d Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 6 Apr 2020 20:11:46 +0530 Subject: [PATCH 30/33] @add: leetcode problem 1 --- README.md | 4 ++++ leetcode/Solution.py | 10 ++++++++++ leetcode/twosum.py | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 leetcode/Solution.py create mode 100644 leetcode/twosum.py diff --git a/README.md b/README.md index 8932926..c9ec0dd 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Day 8](#day-8) - [Day 10](#day-10) - [Day 12](#day-12) + - [Day 13](#day-13) - [Installation](#installation) - [Resources](#resources) @@ -78,6 +79,9 @@ From March 25th, 2020 ### Day 12 - Lambda +### Day 13 + - Solving LeetCode program - [Problem](https://leetcode.com/problems/two-sum/) + ## Installation Command used in Mac for installing supporting tools - Python3 - `brew install python3` diff --git a/leetcode/Solution.py b/leetcode/Solution.py new file mode 100644 index 0000000..f982d62 --- /dev/null +++ b/leetcode/Solution.py @@ -0,0 +1,10 @@ +from typing import List +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + for j in range(0, len(nums)): + for i in range(0, len(nums)): + if (i!=j): + sumOf=nums[j] + nums[i] + if (sumOf == target): + return j, i +# Enumeration is faster than this \ No newline at end of file diff --git a/leetcode/twosum.py b/leetcode/twosum.py new file mode 100644 index 0000000..afeac06 --- /dev/null +++ b/leetcode/twosum.py @@ -0,0 +1,4 @@ +from Solution import Solution + +sol = Solution() +print(sol.twoSum([11, 7,22, 2], 9)) From 9117b005459c24bb6475b65ee082cbcd0fac0531 Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Mon, 6 Apr 2020 20:14:43 +0530 Subject: [PATCH 31/33] @add: leetcode problem 1 --- leetcode/Solution.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/leetcode/Solution.py b/leetcode/Solution.py index f982d62..831268d 100644 --- a/leetcode/Solution.py +++ b/leetcode/Solution.py @@ -7,4 +7,11 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: sumOf=nums[j] + nums[i] if (sumOf == target): return j, i -# Enumeration is faster than this \ No newline at end of file +# Enumeration is faster than this +# def twoSum(self, nums, target): +# a ={} +# for i, num in enumerate(nums): +# if target-num in a: +# return [a[target - num], i] +# else: +# a[num] = i \ No newline at end of file From ac36eee826b1bb1ff1dc4d438c2015c12a6ab8bd Mon Sep 17 00:00:00 2001 From: MovingToWeb <soleil.fils.88@gmail.com> Date: Tue, 7 Apr 2020 11:47:51 +0530 Subject: [PATCH 32/33] @add: tidy up --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c9ec0dd..cb102d0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Playground repo for Python projects -This repo has multiple branches and each branch represent different projects/proof of concepts for playing with Python technologies/frameworks. - -_P.S. `master` branch is empty and has only this `README.md` file_ +This is a learning repo with different projects/proof of concepts for playing with Python technologies/frameworks. ## Table of Contents - [Status Updates](#status-updates) @@ -20,7 +18,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_ - [Resources](#resources) ## Status Updates -From March 25th, 2020 +As part of 21 days of lockdown, I started learning python from March 25th, 2020. ### Day 1 - `cd pipenv` From becfc250863c7ccc43b5cf2059816cfc57a28363 Mon Sep 17 00:00:00 2001 From: tanuchaurasiya <60622131+tanuchaurasiya@users.noreply.github.com> Date: Sun, 4 Oct 2020 17:54:02 +0530 Subject: [PATCH 33/33] Create listComprehension --- functions/listComprehension | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 functions/listComprehension diff --git a/functions/listComprehension b/functions/listComprehension new file mode 100644 index 0000000..6c75ccf --- /dev/null +++ b/functions/listComprehension @@ -0,0 +1,35 @@ +input_list = [1, 2, 3, 4, 4, 5, 6, 7, 7] + +output_list = [] + +# Using loop for constructing output list +for var in input_list: + if var % 2 == 0: + output_list.append(var) + +print("Output List using for loop:", output_list) + + + +input_list = [1, 2, 3, 4, 4, 5, 6, 7, 7] + + +list_using_comp = [var for var in input_list if var % 2 == 0] + +print("Output List using list comprehensions:", + list_using_comp) + + + +output_list = [] +for var in range(1, 10): + output_list.append(var ** 2) + +print("Output List using for loop:", output_list) + + + +list_using_comp = [var**2 for var in range(1, 10)] + +print("Output List using list comprehension:", + list_using_comp)