Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Remi/RandomRecipe()OLD.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (31 sloc)
1.16 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def RandomRecipe(): | |
import random | |
pip install pandas | |
import pandas as pd | |
df= pd.read_csv("RecipesDatabase.csv") | |
RecipeNames = df["Name"].tolist() | |
indexlist= df.index.tolist() | |
ID= random.choice(indexlist) | |
RecipeDescription= df["Description"].tolist() | |
print("The recipe you got was " + RecipeNames[ID]) | |
print(RecipeDescription[ID]) | |
state= 0 | |
while state == 0: | |
happy=input("Are you happy with this recipe?") | |
if happy == "Yes": | |
gluten= df["GlutenProducts"].tolist() | |
dairy= df["DairyProducts"].tolist() | |
others= df["OtherProducts"].tolist() | |
instructions= df["Instructions"].tolist() | |
print(gluten[ID] + dairy[ID] + others[ID]) | |
print(instructions[ID]) | |
state= 1 | |
if happy == "No": | |
print("Im sorry that you didn't like that recipe") | |
rsp=input("Would you like another random recipe?") | |
if rsp == "Yes": | |
RandomRecipe() | |
if rsp == "No": | |
print("I'm sorry that you didn't find what you wanted") | |
state= 1 | |
RandomRecipe() |