-6

The main premise is to get both teams' names and display an icon behind them, so I created dictionaries like

home_team = {'home_foo': '[](#icon-foo) Foo'}
away_team = {'away_bar': '[](#icon-bar) Bar'}

My question is, how can I input a team's name, and create a variable called home_'team name', so I can use the dictionary?

1 Answer 1

2

If I understand your question correctly, I think you might just want to do something like this:

teams = {}

team_name = input("Enter your team name: ")
teams[team_name] = ...

Just replace ... with the specific value you want for that key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.