Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello! I am confused about this one problem >:(. if you could help me without any def and return statements in python it would be

Hello! I am confused about this one problem >:(. if you could help me without any def and return statements in python it would be greatly appreciated! thank you!image text in transcribedimage text in transcribedimage text in transcribed

The city of Teslapolis is an interesting city, to say the least. Due to its location at the peak of the Stormlight Mountains, the entire city is always encompassed by storms, and its residents have invented an ingenious method of harnessing the perpetual lightning to power the city: electrical resonant transformers (ERT's). The ERT's are placed at strategic locations throughout Teslapolis and act as both lightning rods and electrical generators that attract, ground, and harness the lightning's energy. Each ERT is connected to and powers all adjacent buildings (including diagonally adjacent). However, the city currently has no method for rapidly determining if all buildings would be powered given the layout of a new subdivision. As an intern for the city's current administration, your boss has instructed you to write an algorithm that determines, given the layout of a planned subdivision, if all buildings are powered. Suppose you have a 2D list of a subdivision, as shown below: [ [ "T", "b" ], [ "T", "b" ],[ "b", "b" ],["b","b"]] If we were to visualize this 2D list as a grid, it would look like so: "b" represents a building and " T "' represents an ERT. Each ERT powers the eight tiles around it (in yellow). Your task for this week is to write an algorithm that determines, given a 2D list that represents a subdivision, if every building is powered. Example Subdivisions: [ ["b", "b", "b"], ["b", "T", "b"], ["b", "b", "b"] ] True \# The ERT powers all 8 tiles around it. Output is True. b b b [ ["b", "b", "b"] ] False \# There isn't even an ERT. Output is False. \# Unpowered buildings are at [0,],[,1], and [0,2]. b b [ ["b"], ["T"], ["b"] ] True \# The ERT powers the building above it and the building below it. Output is True. [ ["b", "b", "T", "b"], ["T", "b", "b", "b"], ["b", "b", "b", "b"], ["b", "T", "b", "b"] ] False \# Only 2 buildings are not powered, [2,3] and [3,3]. \# Output is False because not every building is powered. Input the number of rows and columns in the subdivision: ROWS >4 COLUMNS > Input each row of the subdivision. ROWO > b b b T ROW1 >T b b b ROW2 > b b b b ROW3 > b T b b Not all buildings are powered! OUTPUT False The following buildings are not powered: OUTPUT [[2,3],[3,3]] Standard 2 Input the number of rows and columns in the subdivision: ROWS >1 COLUMNS 7 Input each row of the subdivision. ROWO> b b b T b b T Not all buildings are powered! OUTPUT False The following buildings are not powered: OUTPUT [[0,],[0,1]] The city of Teslapolis is an interesting city, to say the least. Due to its location at the peak of the Stormlight Mountains, the entire city is always encompassed by storms, and its residents have invented an ingenious method of harnessing the perpetual lightning to power the city: electrical resonant transformers (ERT's). The ERT's are placed at strategic locations throughout Teslapolis and act as both lightning rods and electrical generators that attract, ground, and harness the lightning's energy. Each ERT is connected to and powers all adjacent buildings (including diagonally adjacent). However, the city currently has no method for rapidly determining if all buildings would be powered given the layout of a new subdivision. As an intern for the city's current administration, your boss has instructed you to write an algorithm that determines, given the layout of a planned subdivision, if all buildings are powered. Suppose you have a 2D list of a subdivision, as shown below: [ [ "T", "b" ], [ "T", "b" ],[ "b", "b" ],["b","b"]] If we were to visualize this 2D list as a grid, it would look like so: "b" represents a building and " T "' represents an ERT. Each ERT powers the eight tiles around it (in yellow). Your task for this week is to write an algorithm that determines, given a 2D list that represents a subdivision, if every building is powered. Example Subdivisions: [ ["b", "b", "b"], ["b", "T", "b"], ["b", "b", "b"] ] True \# The ERT powers all 8 tiles around it. Output is True. b b b [ ["b", "b", "b"] ] False \# There isn't even an ERT. Output is False. \# Unpowered buildings are at [0,],[,1], and [0,2]. b b [ ["b"], ["T"], ["b"] ] True \# The ERT powers the building above it and the building below it. Output is True. [ ["b", "b", "T", "b"], ["T", "b", "b", "b"], ["b", "b", "b", "b"], ["b", "T", "b", "b"] ] False \# Only 2 buildings are not powered, [2,3] and [3,3]. \# Output is False because not every building is powered. Input the number of rows and columns in the subdivision: ROWS >4 COLUMNS > Input each row of the subdivision. ROWO > b b b T ROW1 >T b b b ROW2 > b b b b ROW3 > b T b b Not all buildings are powered! OUTPUT False The following buildings are not powered: OUTPUT [[2,3],[3,3]] Standard 2 Input the number of rows and columns in the subdivision: ROWS >1 COLUMNS 7 Input each row of the subdivision. ROWO> b b b T b b T Not all buildings are powered! OUTPUT False The following buildings are not powered: OUTPUT [[0,],[0,1]]

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

=+c. Would it generate press attention?

Answered: 1 week ago