diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..e7e9d11d4 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/Algorithms.iml b/.idea/Algorithms.iml new file mode 100644 index 000000000..d0876a78d --- /dev/null +++ b/.idea/Algorithms.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..399908725 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..49ba2a578 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/recipe_batches/recipe_batches.py b/recipe_batches/recipe_batches.py index c845950c5..61d668848 100644 --- a/recipe_batches/recipe_batches.py +++ b/recipe_batches/recipe_batches.py @@ -1,10 +1,20 @@ #!/usr/bin/python import math +#MAKE SURE EACH VALUE IN THE RECIPE IS GREATER THAN OR EQUAL TO ON HAND THEN DEVIDE THE NUMBER OF INGREDIENTS BY THE NUMBER IN RECIPIE LOWSEST NUMBER WINS +# IF NOT BATCHES 0 def recipe_batches(recipe, ingredients): - pass - + recipie_amount = [] + ingredients_amt = [] + max_batches = 0 + counter = 0 + for i in recipe.values(): + recipie_amount = i + print(recipie_amount) + for i in ingredients.values(): + ingredients_amt = i + print ingredients_amt if __name__ == '__main__': # Change the entries of these dictionaries to test diff --git a/rock_paper_scissors/rps.py b/rock_paper_scissors/rps.py index 0fc53356e..7311c0b38 100644 --- a/rock_paper_scissors/rps.py +++ b/rock_paper_scissors/rps.py @@ -3,8 +3,24 @@ import sys def rock_paper_scissors(n): - pass + #Define list of plays and possibilites + plays = ["rock", "paper", "scissors"] + all_poss = [] + + #Helper function to keep track of the amt or rounds left and the results + def rounds(rleft,res): + + if rleft== 0: + all_poss.append(res) + return + + for i in range(0,len(plays)): + rounds(rleft -1, res + [plays[i]]) + + rounds(n,[]) + return all_poss + if __name__ == "__main__": if len(sys.argv) > 1: diff --git a/stock_prices/stock_prices.py b/stock_prices/stock_prices.py index 9de20bc94..ec8dda7c0 100644 --- a/stock_prices/stock_prices.py +++ b/stock_prices/stock_prices.py @@ -3,8 +3,20 @@ import argparse def find_max_profit(prices): - pass + profit = prices[1] - prices[0] + cost = prices[0] + #for each price starting at the second item in the list + for price in prices[1:]: + # if the price - the cost is greater than profit set profit equal to price minus cost + if (price - cost) > profit: + profit = price - cost + # if the price is less than the cost set cost equal to the new price + if price < cost: + cost = price + + + return profit if __name__ == '__main__': # This is just some code to accept inputs from the command line