Commit fd871f3d authored by Raquel's avatar Raquel 💬

week3, day4

parent e713e5fc
......@@ -2,7 +2,10 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="877aae01-3ab8-4fe8-b0c8-5d560423e0b1" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../WEEK1/DAY2/Restaurant_v2.js" beforeDir="false" afterPath="$PROJECT_DIR$/../WEEK1/DAY2/Restaurant_v2.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DAY 4/requirements.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DAY3/restaurant_vF/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DAY3/restaurant_vF/restaurant.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -13,7 +16,7 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/DAY3/.gitignore">
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_vF/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="9" selection-start-line="1" selection-start-column="9" selection-end-line="1" selection-end-column="9" />
......@@ -21,38 +24,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/DAY3/Books.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="596">
<caret line="40" selection-start-line="40" selection-end-line="40" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/DAY3/restaurant.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="141">
<caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_costumers.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="720">
<caret line="48" column="111" selection-start-line="48" selection-start-column="111" selection-end-line="48" selection-end-column="111" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/DAY3/test.py">
<entry file="file://$PROJECT_DIR$/DAY 4/notes.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="15" selection-start-line="21" selection-start-column="15" selection-end-line="21" selection-end-column="15" />
<state relative-caret-position="120">
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
</state>
</provider>
</entry>
......@@ -115,6 +91,8 @@
<option value="$PROJECT_DIR$/DAY3/test.py" />
<option value="$PROJECT_DIR$/DAY3/restaurant.py" />
<option value="$PROJECT_DIR$/DAY3/restaurant_costumers.py" />
<option value="$PROJECT_DIR$/DAY3/restaurant_vFF.py/.gitignore" />
<option value="$PROJECT_DIR$/DAY 4/notes.py" />
</list>
</option>
</component>
......@@ -129,7 +107,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -137,6 +114,11 @@
<item name="WEEK3" type="b2602c69:ProjectViewProjectNode" />
<item name="WEEK3" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="WEEK3" type="b2602c69:ProjectViewProjectNode" />
<item name="WEEK3" type="462c0819:PsiDirectoryNode" />
<item name="DAY3" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="WEEK3" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
......@@ -145,6 +127,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -271,8 +254,8 @@
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.Books" />
<item itemvalue="Python._pydev_execfile" />
<item itemvalue="Python.Books" />
<item itemvalue="Python.restaurant" />
<item itemvalue="Python.restaurant_costumers" />
<item itemvalue="Python.test (1)" />
......@@ -319,14 +302,20 @@
<option name="project" value="LOCAL" />
<updated>1559196523894</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="week3/ day3">
<created>1559196883693</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1559196883693</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="873" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.8070866" visible="true" weight="0.10711769" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.8070866" visible="true" weight="0.10711769" />
<window_info id="Structure" order="1" sideWeight="0.19291338" side_tool="true" weight="0.21745351" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
......@@ -595,10 +584,17 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/.gitignore">
<entry file="file://$PROJECT_DIR$/DAY3/Books.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="9" selection-start-line="1" selection-start-column="9" selection-end-line="1" selection-end-column="9" />
<state relative-caret-position="600">
<caret line="40" selection-start-line="40" selection-end-line="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/restaurant.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="750">
<caret line="50" selection-start-line="50" selection-end-line="50" />
</state>
</provider>
</entry>
......@@ -609,24 +605,37 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/Books.py">
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_vF.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="596">
<caret line="40" selection-start-line="40" selection-end-line="40" />
<state relative-caret-position="15">
<caret line="1" column="9" selection-end-line="1" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/restaurant.py">
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_vF/restaurant.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_vF/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="141">
<caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
<state relative-caret-position="15">
<caret line="1" column="9" selection-start-line="1" selection-start-column="9" selection-end-line="1" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY3/restaurant_costumers.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="720">
<caret line="48" column="111" selection-start-line="48" selection-start-column="111" selection-end-line="48" selection-end-column="111" />
<state relative-caret-position="360">
<caret line="24" lean-forward="true" selection-start-line="24" selection-end-line="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DAY 4/notes.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
</state>
</provider>
</entry>
......
.idea
.DS_Store
/build/
/dist/
.egg-info
"""
BEFORE THE INIT FILE WAS CREATED:
from my_joke.joke import funny_joke
from my_joke.dark_joke import dark_joke
print (funny_joke())
print (dark_joke())
"""
import my_joke
#package.function
print (my_joke.funny_joke())
print (my_joke.dark_joke())
\ No newline at end of file
import sorting_algorithms_Raquelcodess
#to test if package __init__works
print (sorting_algorithms_Raquelcodess.bubbleSort([1, 2, 3, ]))
print (sorting_algorithms_Raquelcodess.selectionSort([1, 2, 3, ]))
print (sorting_algorithms_Raquelcodess.insertionSort([1, 2, 3, ]))
print (sorting_algorithms_Raquelcodess.quick_sort([4, 1, 2, 3, ]))
from .joke import funny_joke
from .dark_joke import dark_joke
from .dark_joke import * #this will import all the functions in the file
from .dark_joke import function1, function2 #this will import only these specific functions in the file
def dark_joke():
return "bla bla joke"
\ No newline at end of file
def funny_joke():
return "bla bla joke"
import pyjokes
# we can et up cirtual envoronments
#we can set up a VM witha requrements file
print(pyjokes.get_joke())
name: day4
dependencies:
- python==3.7
- pip:
- twine
- flake8
- nose
\ No newline at end of file
from setuptools import setup
setup(name='sorting_algorithms_v3',
version='0.1',
description='sorting algorithms in python3',
url='https://gitlab.propulsion-home.ch/',
author='Raquelcodes',
author_email='Raquelcodes@example.com',
license='MIT',
packages=['sorting_algorithms_v3'],
test_suite='nose.collector',
tests_require=['nose'],
zip_safe=False)
\ No newline at end of file
def bubbleSort(alist):
for passnum in range(len(alist) - 1, 0, -1):
for i in range(passnum):
if alist[i] > alist[i + 1]:
temp = alist[i]
alist[i] = alist[i + 1]
alist[i + 1] = temp
return alist
def insertionSort(alist):
for index in range(1, len(alist)):
currentvalue = alist[index]
position = index
while position-1 >= 0 and alist[position-1] > currentvalue:
alist[position] = alist[position-1]
position = position - 1
alist[position] = currentvalue
return alist
def quick_sort(alist):
quick_sort_helper(alist, 0, len(alist) - 1)
return alist
def quick_sort_helper(alist, first, last):
if first < last:
splitpoint = partition(alist, first, last)
quick_sort_helper(alist, first, splitpoint - 1)
quick_sort_helper(alist, splitpoint + 1, last)
def partition(alist, first, last):
pivotvalue = alist[first]
leftmark = first + 1
rightmark = last
done = False
while not done:
while leftmark <= rightmark and alist[leftmark] <= pivotvalue:
leftmark = leftmark + 1
while alist[rightmark] >= pivotvalue and rightmark >= leftmark:
rightmark = rightmark - 1
if rightmark < leftmark:
done = True
else:
temp = alist[leftmark]
alist[leftmark] = alist[rightmark]
alist[rightmark] = temp
temp = alist[first]
alist[first] = alist[rightmark]
alist[rightmark] = temp
return rightmark
This package has several sorting algorithms in python3.
ENJOY!
\ No newline at end of file
def selectionSort(alist):
for fillslot in range(len(alist) - 1, 0, -1):
positionOfMax = 0
for location in range(1, fillslot + 1):
if alist[location] > alist[positionOfMax]:
positionOfMax = location
temp = alist[fillslot]
alist[fillslot] = alist[positionOfMax]
alist[positionOfMax] = temp
return alist
from .Bubble_Sort import *
from .Insertion_Sort import *
from .Quick_Sort import *
from .Selection_Sort import *
from .tests import *
\ No newline at end of file
import unittest
from unittest import TestCase
import sorting_algorithms_v3
class TestSorting1(TestCase):
def test_is_Sorted(self):
s = [1,4,3,2]
t = sorting_algorithms_v3.bubbleSort(s)
self.assertEqual(t, [1,2,3,4])
class TestSorting2(TestCase):
def test_is_Sorted(self):
s = [1, 4, 3, 2]
self.assertEqual(sorting_algorithms_v3.selectionSort(s), [1, 2, 3, 4])
class TestSorting3(TestCase):
def test_is_Sorted(self):
s = [1, 4, 3, 2]
self.assertEqual(sorting_algorithms_v3.insertionSort(s), [1, 2, 3, 4])
class TestSorting4(TestCase):
def test_is_Sorted(self):
s = [1, 4, 3, 2]
self.assertEqual(sorting_algorithms_v3.quick_sort(s), [1, 2, 3, 4])
if __name__ == '__main__':
unittest.main()
.idea
.DS_Store
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment