I need help with a problem: Your task is to build a program that randomly recommends a different kind of one type of fruit each day. The user should be able to pick from a menu of at least three different kinds of fruit (banana is a required selection). The program should also randomly select a new fruit variant for all 30 days of a month. For example, I should be able to choose between: banana, apple, and kiwi. I will select kiwi. It will then produce a randomly selected list of 30 different types of kiwi and present them in a list. If I run the program again and select kiwi, then it will return a new list of kiwi.
It needs to have randomly selected list (which I already created the list), and all 30 days of the month.
I have created a Fruit class and an input statement for the user but am stuck.
from random import randrange
class Fruit:
def __init__(self, banana, apple, kiwi):
self.banana=banana
self.apple=apple
self.kiwi=kiwi
def main():
userInput=input("Enter the type of fruit: ")
Aucun commentaire:
Enregistrer un commentaire