Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 16: Let's do some more logic. Make an if . elif, and else statement 1 10 10 11 11 11 In the if-statement, check

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Task 16: Let's do some more logic. Make an if . elif, and else statement 1 10 10 11 11 11 In the if-statement, check whether the sighting is aggressive. If it is, print out that it's aggressive, and that we need to back away and cover our heads. In addition, print out that we need to photograph the sighting at its location. In the elif-statement, check whether the sighting is endangered. If it is, print out that it's endangered, and that we need to back away. Also, print out that we need to photograph the sighting at its location. In the else statement (i.e, the sighting is neither aggressive nor endangered) print out that we need to photograph the ultra rare sighting at its location. In all of these blocks, make use of the actions list and the variables sighting and location in your printouts. 11 11 Wor main.py 1 #task 1 2 rerebirds = { 3 "Gold-crested Toucan' : { 4 Height (m): 1.1, 5 Weight (kg): 35, Color': 'Gold', 'Endangered': True, 8 Aggressive': True}, 9 "Pearlescent Kingfisher': { 10 "Height (m): 0.25, 11 Weight (kg): 0.5, 12 "Color': 'White', 13 'Endangered': False, 14 'Aggressive': False}, 15 "Four-metre Hummingbird': { 16 "Height (m)':0.6, 17 Weight (kg)':0.5, 18 Color' : 'Blue', 19 'Endangered': True, 20 "Aggressive': False}, 21 "Giant Eagle': { 22 "Height (m)':1.5, 23 'Weight (kg)':52, 24 "Color': 'Black and White', 25 "Endangered': True, 26 "AEgressive': True}, 27 *Ancient Vulture':{ "Height (m)':2.1, 29 Weight (kg)':70, 30 Color': 'Brown', 31 'Endangered":False, 32 Aggressive':False}, 33 } 34 35 #task 2 36 birdlocation = {'In the canopy directly above our heads'. 37 'Between my 6 and 9 oclock above', 38 'Between my 9 and 12 o'clock above', he 28 in stod > 27 Bulween my o ano OCLOCK above, 38 'Between my 9 and 12 o'clock above', 39 'Between my 12 and 3 o'clock above', 40 'Between my 3 and 6 o'clock above', 41 'In a nest on the ground', 42 'Right behind you') 43 print(birdlocation) 44 print(len(birdlocation)) 45 46 47 #task 3 48 codes = {'111':'In the canopy directly above our heads', 49 '110':'Between my 6 and 9 oclock above', 50 '101':'Between my 9 and 12 o'clock above', 51 '100':'Between my 12 and 3 o'clock above', 52 *011':'Between my 3 and 6 o'clock above', 53 *010':'In a nest on the ground, 54 001':'Right behind you' 55 } 56 57 #task 4 58 actions = ('Back Away','Cover our Heads', 'Take a Photograph') 59 60 #task 5 61 print(razebirds['Giant Eagle' ('Aggressive']) 62 63 64 #task 6 65 for key, value in rarebirds. Items(): 66 if value( 'Aggressive'] == True: 67 print(key + ":" + actions[1]) 68 69 for key, value in rerebirds. Items(): If value' 'Endangered') == True: 71 print(key + ":" + actions[@]) 72 73 #task 7 74 for key in codes: ---It. the 70 bin lue stod 75 deaf. 74 for key in codes : 75 print(key->', codes[key]) 76 77 #task 8 78 for key, value in rarebirds. items(): 79 value( 'seen']=False 80 print(rarebirds) 81 82 83 #task 9 84 encounter = True 85 86 #task 10 87 sighting = input('what do you see?') 8B 89 #task 11 90 rarebirdsList = list(rarebirds.keys()) 91 print(rarebirdsList) 92 93 #task 12 94 while encounter = True: 95 sighting = input("what do you see?") 96 rarebirdsList = list(rarebirds.keys()) 97 98 if sighting in rarebirdsList: 99 print("This is one of the birds we're looking for!") 100 else: 101 print("That's not one of the birds we're looking for. 102 was not able to finish this task 103 104 #task 13 105 code = input('Where do you see it') 106 207 #task 14 106 location = codes(code) 109 110 task 15 111 print("So you've seen sighting, location. "My goodness.") main.py xt 78 for key, value in rarebirds. items(): 79 value['seen']=False 80 print(rarebirds) 81 82 83 #task 9 84 encounter = True 85 86 #task 10 87 sighting = Input('what do you see?') 88 89 #task 11 90 rarebirdsList = list(razebirds. keys()) 91 print(rarebirdsList) 92 93 #task 12 94 while encounter = True: 95 sighting = input("what do you see?") rarebirdsList = list(rarebirds.keys()) if sighting in razebirdsList: print("This is one of the birds we're looking for!") 100 else: 101 print("That's not one of the birds we're looking for.") 102 #was not able to finish this task 103 104 #task 13 105 code = Input('Where do you see it') 106 107 #task 14 108 location = codes(code] 109 110 #task 15 111 print("So you've seen a", sighting, location. "My goodness.) 112 113 #task 16 114 115 96 97 98 99

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

Students also viewed these Databases questions

Question

What is your biggest complaint about your job?

Answered: 1 week ago

Question

(LO 3-3) How is similarity matching different from clustering?

Answered: 1 week ago