I need to write a function named listsearch, which accepts a single parameter, but I don't know how.
The two lists (facts and factsK) must remain separate.
I was trying to move both print statements into separate functions and just calling it at the end because the code requires two calls, I can't figure out how to proceed
facts = ["Hitler invaded Poland in 1939 which drove Great Britain and France to Declare war",
"Germany occupied Norway and Denmark and started the 'Blitzkrieg' against Belgium and the Netherlands",
"Following the attack on Pearl Harbor, the USA declares war against Japanese",
"USA begins raiding Japanese islands and bombing the mainland military targets",
"Allies invade Sicily and put Mussolini out of power",
"The Allies conduct the largest amphibious invasion ever at the Battle of Normandy where over 155,000 allied troops fought through the Atlantic wall to create a new front in France",
"May 8th 1945 Germany surrendered after the Soviets invaded Berlin"]
factsK = ["The deadliest battle in the War, Germany and its allies fought the Soviets for the city with extreme close quarters combat and direct air raids on civilians",
"Was a German military tactic calculated to create psychological shock and resultant disorganization in enemy forces through the employment of surprise, speed, and superiority",
"The allies were losing the battle of France and were pushed to the port of Dunkirk by the Germans. The Germans halted their push for three days which allowed the allies to organize a retreat, more than 330,000 Allied troops were rescued",
"In 1941, Just before that Sunday morning, hundreds of Japanese fighter planes descended on the base, where they managed to destroy or damage nearly 20 American naval vessels, 300 airplanes, and 2,400 Americans, Japan was hoping to cripple the American fleet before they entered the war. The USA declared war the day after",
"Codenamed Operation Overlord, the battle began on June 6, 1944, also known as D-Day, when some 155,000 American, British and Canadian forces landed on five beaches along a 50 mile stretch of the heavily fortified coast of France’s Normandy region, creating a second front.D-Day was known as the beginning of the end of the War.",
"The liberation of Paris occurred in 1944 where French Liberation forces staged an uprising against the Germans while the Americans were quickly approaching. Once the American army arrived in the city the German Garrison commander Dietrich von Choltitz, surrendered to the French allowing them to have the city again",
"The battle of Berlin occurred in 1945 and was one of the last major offensives in the war. The Soviets successfully encircled the city, The Germans refused to surrender, but the Soviets were too overpowering for the remaining troops. Hitler ended up committing suicide and the remaining German troops were captured or killed. The Nazis officially surrendered a week later on May 9th"]
User = input("Keyword or date: ")
Dates = ["1939","1940","1941","1942","1943","1944","1945"]
Keywords =["Stalingrad","Blitz","Dunkirk","Pearl Harbor","D-Day","Paris","Berlin"]
for D in Dates:
if D == User:
print(facts[Dates.index(D)])
def listSearch ():
for K in Keywords:
if K == User:
print(factsK[Keywords.index(K)])
What I have tried:
I tried moving the def() to define each print statement and call at the end but I cant figure it out.