Commit 04824d26 authored by Raquel's avatar Raquel 💬

week4, day1

parent fd871f3d
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='sorting_algorithms_v3',
version='0.1',
description='sorting algorithms in python3',
......
......@@ -7,5 +7,3 @@ def bubbleSort(alist):
alist[i] = alist[i + 1]
alist[i + 1] = temp
return alist
......@@ -10,4 +10,3 @@ def insertionSort(alist):
alist[position] = currentvalue
return alist
This package has several sorting algorithms in python3.
ENJOY!
\ No newline at end of file
This package has several sorting algorithms in python3.7.
To use (with caution), simply do::
>>> import sorting_algorithms_v3
>>> print sorting_algorithms_v3.bubbleSort()
>>> print sorting_algorithms_v3.insertionSort()
>>> print sorting_algorithms_v3.selectionSort()
>>> print sorting_algorithms_v3.quick_sort()
ENJOY!
......@@ -9,5 +9,3 @@ def selectionSort(alist):
alist[fillslot] = alist[positionOfMax]
alist[positionOfMax] = temp
return alist
class Bookshelf:
def __init__(self, books):
self.books=books
self.book_storage = []
self.add_book()
#method to add books to bookshelf (book_storage)
def add_book(self):
for x,y in self.books:
self.book_storage.append(Book(x,y))
for book in self.book_storage:
print (book)
class Book:
def __init__(self,title,author):
self.title=title
......@@ -33,19 +19,8 @@ class Book:
def __str__(self):
return f"{self.title} by {self.author}"
#book1=Book("title1", "author1")
#print(book1)
book_shelf=Bookshelf(books=[('The old man and the see', 'Ernest Hemingway'),
('Beyond Good and Evil', 'Friedrich Nietzsche'),])
#print(book_shelf)
\ No newline at end of file
#print(book_shelf)
......@@ -15,70 +15,49 @@ class Dish:
profit= self.price - self.cost()
return profit
def __str__(self):
return self.name
class Restaurant:
def __init__(self):
self.order=[]
def order_dish(self,client,dish):
self.order.append([client,dish])
return self.order
def print_orders(self, client):
for order in self.order:
return f" Customer {client} \n Order # {self.order.index(order)} : {order[1]} - {order[1].price}"
def print_check(self,client):
total=0
# this code is just to assure the customer name will be printed only once
if len(list(zip(*self.order))[0]) > 0: #zip retrieves the first element accross a lists and returns a list with them
print(f" Customer {client} \n ")
#if len(list(zip(*self.order))[0]) > 0: #zip retrieves the first element accross a lists and returns a list with them
# print(f" Customer {client} \n ")
#end
#OR just print out the line bc I am passing it as a parameter:
print(f" Customer {client} \n ")
for order in self.order:
if order[0] == client:
total += order[1].price
print( f" Order # {self.order.index(order)} : {order[1]} - {order[1].price}")
print(f" Total: {total}")
class Ingredients:
def __init__(self,name, cost):
self.name=name
self.cost=cost
cheese = Ingredients('Cheese', 5)
pepperoni = Ingredients('pepperoni', 5)
dough = Ingredients('dough', 5)
pizza = Dish("Pizza", 35, [cheese, pepperoni, dough])
salad = Dish("salad", 35, [cheese, pepperoni, dough])
restaurant= Restaurant()
restaurant.order_dish("Goofy", pizza)
restaurant.order_dish("Goofy", salad)
#print(restaurant.print_orders("Goofy"))
restaurant.print_check("Goofy")
.idea
.DS_Store
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (week3day5.1)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (week3day5.1)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/DAy5.iml" filepath="$PROJECT_DIR$/.idea/DAy5.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
name:
dependencies:
- python==3.7
- pip:
- django==2.2.1
- flake8
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