26.1k views
1 vote
Create a dictionary with at least ten national teams that identifies their confederation. Make sure to include at least one entry for each of the six confederations. Prompt the user to ask whether they would like to search a country or a confederation. If the user wishes to search a country, the program should return that country's confederation. If the user wishes to search a confederation, the program should return ALL countries in that confederation (all that are in your dictionary, anyway;-)

1 Answer

3 votes

Answer:

teams={'Pakistan':'UEFA','Spain':'UFEA','Japan':'CONMEBOL','Brazil':'CONMEBOL','Canada':'CONCACAF','Zimbabwe':'CAF','India':'AFC','Fiji':'OFC','France':'UEFA','Germany':'UEFA'}

def country():

print("Enter country name from the following list of countries")

print(list(teams.keys()))

m=input()

print("Confederation-"+teams[m])

def confed():

print("Enter confederation name from the following list of confederations")

print("UEFA,CONMEBOL,CONCACAF,CONMEBOL,OFC,AFC")

m=input()

print("Countries under "+m+" are")

for k,v in teams.items():

if v == m:

print(k)

print("What would you like to search?")

print("1.Country")

print("2.Confederation")

n=int(input())

if n==1:

country()

elif n==2:

confed()

else:

print("Invalid choice")

Step-by-step explanation:

User Luxi Liu
by
4.4k points