Skip to content
This repository was archived by the owner on Jul 18, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion eating_cookies/eating_cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,23 @@
# The cache parameter is here for if you want to implement
# a solution that is more efficient than the naive
# recursive solution

##eating cookies is going to allow us to figure out how many Ways there are to eating cookies
## n is effictbley cookies with 1,1,1 1,2 2,1 3
def eating_cookies(n, cache=None):
pass
count = 0
if n == 0 or n == 1:
return 1
elif n == 2:
return 2
else:
arr = [1, 1, 2]
for number in range(3, n+1):
count = arr[-3] + arr[-2] + arr[-1]
arr.append(count)

return count


if __name__ == "__main__":
if len(sys.argv) > 1:
Expand Down
16 changes: 15 additions & 1 deletion recipe_batches/recipe_batches.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
#!/usr/bin/python

## whats the question asking: how many batches of a recipe can we make from th input of 2 dictionaries dic1(recipes), dic2(ingreidents)
## with this in mind we need to input both dictionaries and return the maxium batches possible may be //
## https://www.w3schools.com/python/python_sets.asp
##https://www.w3schools.com/python/ref_func_min.asp

import math

def recipe_batches(recipe, ingredients):
pass
if set(recipe) == set(ingredients): ## check to see if we have the correct ammount of ingredients to make a single or multiple bacthes
batches =[]
for i in recipe: ## check how many if any ammount of batches can be made from what we have avaible
if ingredients[i] >= recipe[i]:
consumed = ingredients[i] // recipe[i]
batches.append(consumed)
return min(batches) ## this will show us what is the minium ammount of batches we can make
## we need to make a case senario for when there is not enough to make any batches using else and have the return be zero
else:
return 0


if __name__ == '__main__':
Expand Down
17 changes: 16 additions & 1 deletion stock_prices/stock_prices.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#!/usr/bin/python

### whats the problem we have a list of numbers, and we need to check which number is the biggest in the list then store and compare
## this index to the number with the lowest index and then take the lowest from the highest

import argparse

def find_max_profit(prices):
pass
mp = [0] ## set max profit to initial 0

for i in range(0, len(prices) -1): ## getting the initial value from mp to the last element
ci = i ## define index

for x in range(ci + 1, len(prices) -1): ## initiate the check from initial index to last index -1
if prices[x] - prices[ci] > mp[0]: ## subtract current index from the index we have in prices
mp[0] = prices[x] - prices[ci]

elif prices[x] - prices[ci] < 0 and mp[0] == 0: ## if we hit negative numbers
mp[0] = prices[x] - prices[ci]

return mp[0]


if __name__ == '__main__':
Expand Down