Design a raptor program that randomly selects a food special by putting together a protein (ie steak, sushi, fish, chicken, mussels, tofu etc) a vegetable, and a starch. The raptor program should store 10 types of protein, 10 starches, and 10 vegetables in 3 different one-dimensional arrays that should be read from a file. The raptor program should pick 3 random numbers between 1 and 10 to use for choosing the meal items.
import random
file = open('vegetables.txt', 'r')
vegetables = file.readlines()
file = open('protien.txt', 'r')
protien = file.readlines()
file = open('starch.txt', 'r')
starch = file.readlines()
recommendation = []
#select random index from vegetables,protiens and starch
recommendation.append(vegetables[random.randint(0,len(vegetables))].strip())
recommendation.append(protien[random.randint(0,len(protien))].strip())
recommendation.append(starch[random.randint(0,len(starch))].strip())
print(recommendation)
Filenames and their contents. You can add more lines to files
1] vegetables.txt
Beet
Radish
Carrot
Garlic
Onion
carrot
broccoli
asparagus
cauliflower
corn
cucumber
eggplant
green pepper
2] protiens.txt
steak
sushi
fish
chicken
mussels
tofu
3] starch.txt
Potato
Sweet Potato
bread
cereal
rice
pasta
Get Answers For Free
Most questions answered within 1 hours.