Poem Challenge 6

Challenge 6 Create a list of vegetables and get your program to randomly choose one
Open mash3.py or copy this code
print("Mashed",veg," on the ceiling.")
print("Green",veg," on the floor.")
print("Stewed",veg," in the corner.")
print(veg,"upon the door.")
Save the program as mash6.py
Above all your code import random
import random
#This allows us to use the random command later
Underneath random create a list by copying and expanding this code with some of the vegetables underneath
veglist = ["beans","broccoli"]
Artichoke Asparagus Beans peas Broccoli Sprouts Cabbage Carrots Cauliflower Celery Cucumber Eggplant Fennel Garlic Lettuce Mushroom Okra Onion Pepper Potatoes Pumpkin Radish Rhubarb Spinach Squash Corn Tomato Turnip
Underneath veglist adapt your veg variable so that it is chosen randomly from your veglist
veg = random.choice(veglist) # a random word is chosen from your veglist and put into the variable veg
Save the program
Run the program

If your coding is correct a randomly choosen vegetable will be used within the poem.

Problems?
Watch this video if you don't understand what to do.
If your code doesn't fails work through the DEBUG

Comments