Sep-26-2020, 09:39 PM
Do you want to print all the information for each of the inputs, or just some of them?
You could have a list of random information and print one or two. Or you could characterize them like "season_info" and "average_temp" and pick what information is returned or printed.
I'd probably prefer to store everything in a separate file with some structure and read it in. For now, maybe lets just put it in JSON format.
month.json
You could have a list of random information and print one or two. Or you could characterize them like "season_info" and "average_temp" and pick what information is returned or printed.
I'd probably prefer to store everything in a separate file with some structure and read it in. For now, maybe lets just put it in JSON format.
month.json
{"January":[ "Northern Hemisphere Winter", "Average high temp is 46F", "Named for the Roman god Janus" ] }code
import json INFOFILE = "month.json" f = open(INFOFILE, "r") monthdata = json.load(f) query = input("What's your input? ") if monthdata.get(query): for info in monthdata[query]: print(info) else: print(f"I have no information on {query}")
Output:What's your input? January
Northern Hemisphere Winter
Average high temp is 46F
Named for the Roman god Janus
Output:What's your input? February
I have no information on February