Question

In: Computer Science

Did you know that there are over 500 types of bananas in the world? Did you...

Did you know that there are over 500 types of bananas in the world? Did you also know that bananas are an excellent source of potassium, fiber, and vitamin B-6 as well as serve as a powerful antioxidant? However, most people might not be aware of the prolific amount of banana consuming possibilities that are available to them. Wouldn't it be amazing if we have a program that would randomly recommend a type of banana for someone to eat every day as part of a complete and balanced breakfast. However, say you don't like bananas and would prefer apples (over 2000 varieties) or kiwi fruit (50 types).

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.

Your program should practice a separation of concerns, select from the list randomly, and provide a menu or display.

Solutions

Expert Solution

import random
Fruits = ["Banana","Apples","Kiwi","Mango"]

Varieties = {"Banana": ['Chingan banana','Lacatan banana','Lady Finger banana','Pisang jari buaya','Señorita banana','Sinwobogi banana','Dwarf Cavendish','Giant Cavendish','Grand Nain','Masak Hijau','Robusta','Red Dacca','Dwarf Red banana','Gros Michel banana','East African Highland bananas','Maqueño banana','Popoulu banana','Mysore banana','Pisang Raja banana','French plantain','Green French banana','Horn plantain & Rhino Horn banana','Nendran banana','Pink French banana','Tiger banana','Pome banana','Prata-anã banana','Latundan banana','Bluggoe banana','Silver Bluggoe banana','Pisang Seribu banana','plu banana','French plantain','Green French banana','Horn plantain & Rhino Horn banana','Nendran banana','Pink French banana','Tiger banana'],
             "Apples": ['Apple_v_1','Apple_v_2','Apple_v_3','Apple_v_4','Apple_v_5','Apple_v_6','Apple_v_7','Apple_v_8','Apple_v_9','Apple_v_10','Apple_v_11','Apple_v_12','Apple_v_13','Apple_v_14','Apple_v_15','Apple_v_16','Apple_v_17','Apple_v_18','Apple_v_19','Apple_v_20','Apple_v_21','Apple_v_22','Apple_v_23','Apple_v_24','Apple_v_25','Apple_v_26','Apple_v_27','Apple_v_28','Apple_v_29','Apple_v_30','Apple_v_31','Apple_v_32','Apple_v_33','Apple_v_34','Apple_v_35'],
             "Kiwi": ['Kiwi_v_1','Kiwi_v_2','Kiwi_v_3','Kiwi_v_4','Kiwi_v_5','Kiwi_v_6','Kiwi_v_7','Kiwi_v_8','Kiwi_v_9','Kiwi_v_10','Kiwi_v_11','Kiwi_v_12','Kiwi_v_13','Kiwi_v_14','Kiwi_v_15','Kiwi_v_16','Kiwi_v_17','Kiwi_v_18','Kiwi_v_19','Kiwi_v_20','Kiwi_v_21','Kiwi_v_22','Kiwi_v_23','Kiwi_v_24','Kiwi_v_25','Kiwi_v_26','Kiwi_v_27','Kiwi_v_28','Kiwi_v_29','Kiwi_v_30','Kiwi_v_31','Kiwi_v_32','Kiwi_v_33','Kiwi_v_34','Kiwi_v_35'],
             "Mango": ['Mango_v_1','Mango_v_2','Mango_v_3','Mango_v_4','Mango_v_5','Mango_v_6','Mango_v_7','Mango_v_8','Mango_v_9','Mango_v_10','Mango_v_11','Mango_v_12','Mango_v_13','Mango_v_14','Mango_v_15','Mango_v_16','Mango_v_17','Mango_v_18','Mango_v_19','Mango_v_20','Mango_v_21','Mango_v_22','Mango_v_23','Mango_v_24','Mango_v_25','Mango_v_26','Mango_v_27','Mango_v_28','Mango_v_29','Mango_v_30','Mango_v_31','Mango_v_32','Mango_v_33','Mango_v_34','Mango_v_35']}
print("Hey..Welcome to fruit selector")
print("Enter serial number to select fruit")
serial = 0
for i in Fruits:
    serial = serial + 1
    print(serial,".",i)
choice = input("Enter your choice:")
choice = int(choice)
if choice<1 or choice>len(Fruits):
    print("***Invalid Response***")
else:
    print()
    print("Following are the varieties of",Fruits[choice-1], " you need to try")
    suggest = random.sample(Varieties.get(Fruits[choice-1]), 30)
    serial = 0
    for i in suggest:
        serial = serial + 1
        print("Day:",serial,i)
    

Please note the varieties of fruits are not real ones, they are just for the understanding of the program


Related Solutions

You know the meaning of the word "diploid." Bananas are triploid. What do you suppose that...
You know the meaning of the word "diploid." Bananas are triploid. What do you suppose that means? Wheat is a hexaploid. What does that mean? Triploid bananas are sterile — they reproduce only asexually. What problems do you suppose a triploid has in meiosis that might explain this? NOTE: Yes, I know it's easy to discover that nuclei must have an even number of chromosome sets to do meiosis. The question here is why?
Please do in java Program 3: Give a baby $5,000! Did you know that, over the...
Please do in java Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement...
How did the fires in the amazon impact the production of bananas in brazil? What are...
How did the fires in the amazon impact the production of bananas in brazil? What are the implications of this on the market for bananas in Brazil?
How did the bush fires impact the production of bananas? What are the implications of this...
How did the bush fires impact the production of bananas? What are the implications of this on the market for bananas in Australia?
Produce Company needs to know the pounds of bananas to have on hand each day. Each...
Produce Company needs to know the pounds of bananas to have on hand each day. Each pound of bananas costs $.25 and can be sold for $.40 Unsold bananas are worthless at the end of the day. The following demands were found after studying the last six months sales: 200 pounds of bananas one fourth of the time. 300 pounds of bananas one half of the time 400 pounds of bananas one half of the time required determine whether ABC...
roduce Company needs to know the pounds of bananas to have on hand each day. Each...
roduce Company needs to know the pounds of bananas to have on hand each day. Each pound of bananas costs $.25 and can be sold for $.40 Unsold bananas are worthless at the end of the day. The following demands were found after studying the last six months sales: 200 pounds of bananas one fourth of the time. 300 pounds of bananas one half of the time 400 pounds of bananas one half of the time required determine whether ABC...
Consider an economy that produces only three types of fruit: apples, oranges & bananas. In the...
Consider an economy that produces only three types of fruit: apples, oranges & bananas. In the base year the production & price data are as follows: Fruit      Quantity    Price Apples 3000 Unit Rs. 2 per unit Bananas 6000 Unit Rs. 3 per unit Oranges 8000 Unit Rs. 4 per unit In the current year the production & price data are as follows: Fruit     Quantity    Price Apples 4000 Unit Rs. 3 per unit Bananas 14,000      Unit...
In the world of finance, you will hear one mantra over and over: maximizing stakeholder value...
In the world of finance, you will hear one mantra over and over: maximizing stakeholder value OR shareholder value OR debtholder value" . This has long been considered the primary financial goal of any public corporation. A shareholder OR debtholder OR stakeholder is basically just another word for an investor, somebody who buys a company's stock. A shareholder OR stakeholder OR debtholder is simply somebody who has an interest or something at stake when it comes to how a business...
How well do you really know your customers? And how well did they want to know...
How well do you really know your customers? And how well did they want to know you right?
You are a a silver retailer. You source silver from all over the world and you...
You are a a silver retailer. You source silver from all over the world and you sell it to your clients. Your main clients are battery manufacturers and circuit manufacturers. Today (July 4th) you buy 10,000 oz of silver at 16 dollars an ounce for your inventories. If you want to hedge your spot position in the futures market, would you go long or short? Suppose you expect to sell all this silver over the next six months so you...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT