diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af6d502 --- /dev/null +++ b/.gitignore @@ -0,0 +1,123 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ba76e2d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Deepak Raj + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/While_loop.py b/While_loop.py new file mode 100644 index 0000000..8a9d170 --- /dev/null +++ b/While_loop.py @@ -0,0 +1,13 @@ +'''while Loop''' +'''github''' + +condition=2 + +while condition<=10: + print(condition) + condition+=1 + +'''Infinty Loop''' + +while True: + print('Doing stuff') diff --git a/condtionals and booleans.py b/condtionals and booleans.py new file mode 100644 index 0000000..ec57736 --- /dev/null +++ b/condtionals and booleans.py @@ -0,0 +1,21 @@ + +class Employee: + """A sample Employee class""" + + def __init__(self, first, last): + self.first = first + self.last = last + + print('Created Employee: {} - {}'.format(self.fullname, self.email)) + + @property + def email(self): + return '{}.{}@email.com'.format(self.first, self.last) + + @property + def fullname(self): + return '{} {}'.format(self.first, self.last) + + +emp_1 = Employee('peter', 'anderson') +emp_2= Employee('joy', 'andrew') diff --git a/for loop.py b/for loop.py new file mode 100644 index 0000000..8f2c3ca --- /dev/null +++ b/for loop.py @@ -0,0 +1,8 @@ +'''For Loop''' + +list_001=[21,22,54,67,78,44,36,89,95,34,23,66,42,62,67,42,56,24,34,63,23,52,25,27,38] +for x in list_001: + print(x) +print('Next') + +print('continue program') diff --git a/function2.py b/function2.py new file mode 100644 index 0000000..af08cde --- /dev/null +++ b/function2.py @@ -0,0 +1,22 @@ +def my_func(food): + for x in food: + print(x) + +fruits_list =['Apple','Mango','Banana','Guavava'] +electronics_item=['charger','iron','Fridge','Fan',"T.v"] + +print('List 1') +my_func(fruits_list) +print('----------------------') +print('List 2') +my_func(electronics_item) + #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +def mul_fun(x): + return 2**x + +print(mul_fun(2)) +print(mul_fun(3)) +print(mul_fun(4)) +print(mul_fun(5)) +print(mul_fun(6)) diff --git a/function3.py b/function3.py new file mode 100644 index 0000000..e69de29 diff --git a/python_function.py b/python_function.py new file mode 100644 index 0000000..a64282f --- /dev/null +++ b/python_function.py @@ -0,0 +1,33 @@ +def fname(): + print("Hello") +fname() + +####################### + +def my_function(fname,lname): + + print(fname,lname) + + +my_function('John','Green') +my_function('Alice','bob') +my_function('Eve','addy') + + +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +def my_function2(country='India'): + print("I am From "+ country) + +my_function2("U.S.A") +my_function2("U.K") +my_function2() +my_function('United','Nation') + +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +def func(): + print('This is a my_function') + +func() +func() diff --git a/python_json.py b/python_json.py new file mode 100644 index 0000000..287f298 --- /dev/null +++ b/python_json.py @@ -0,0 +1,20 @@ +import json + +x = { + "name": "John", + "age": 30, + "married": True, + "divorced": False, + "children": ("Ann","Billy"), + "pets": None, + "cars": [ + {"model": "BMW 230", "mpg": 27.5}, + {"model": "Ford Edge", "mpg": 24.1} + ] +} + +# convert into JSON: +y = json.dumps(x) + +# the result is a JSON string: +print(y) diff --git a/range_function.py b/range_function.py new file mode 100644 index 0000000..51734b4 --- /dev/null +++ b/range_function.py @@ -0,0 +1,2 @@ +for x in range(1,10): + print(x)