Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

may i know what hidden input did i fail? tructions Forum Tutoring Problem Write a function is_capital(state, city) that returns True if the named city

may i know what hidden input did i fail? image text in transcribed
image text in transcribed
tructions Forum Tutoring Problem Write a function is_capital(state, city) that returns True if the named city is the capital of the named state and False otherwise. Every city and state in the following table should be recognised. State Capital city New South Wales Sydney Queensland Brisbane South Australia Adelaide Tasmania Hobart Victoria Melbourne Western Australia Perth If a city or state is not in the table the function must return false. Here are some examples of how your function should work: >>> is_capital('Victoria', 'Melbourne') True >>> is_capital('Queensland', 'Adelaide') False apital City Testing > Run Terminal Reset program.py > WN 1 def is_capital(state, city): 2 dict = {'New South Wales': 'Sydney', 'Queensland': 'Brisbane', 3 'South Australia': 'Adelaide', 'Tasmania': 'Hobart', 'Victoria': 'Melbourne', 'Western Autralia': 'Perth'} 5 for key, value in dict.items(): 6 if (key==state and value == city): return True 4 5 5 000 return false Submissions Output #8 Not yet! Failed a test (4 tests passed). 25 minutes ago Checking your submission against PEP8. Testing the first example from the problem. Testing the second example from the problem. Testing a territory that is not in the table of capitals. X Testing a hidden input. Autosaved 25 minutes ago 3 days ago > #7 Not yet! Failed a test (4 tests passed)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago