2.15 LAB: Artwork label (modules) Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "unknown" and the years of birth and death to -1. Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize the title to unknown', the year created to -1, and the artist to use the Artist default constructor parameter values. Add an import statement to import the Artist class. Add import statements to main.py to import the Artist and Artwork classes. Ex If the input is: Pablo Picasso 1881 1973 Three Musicians 1921 the output is: Artist: Pablo Picasso (1881 to 1973) Title: Three Musicians, 1921 Ex: If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden (1938 to present) Title: Distant Muses, 2000 Ex: If the input is: Banksy -1 -1 Balloon Girl 2002 the output is: Artist: Banksy (unknown) Title: Balloon Girl, 2002

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please correct the code for this lab. Current code: import random def create_random_open_ports(): #Create empty list / dictionary port = [] ports = {} #Fill list with 100 random port numbers from 10 - 100 for i in range(1,101): random_port = random.randint(10, 100) port.append(random_port) #Create a new dictionary with ports numbers as keys new_ports = ports.fromkeys(port, 0) #Iterate through new dictionary add random 0 / 1 #Closed port = 0, Open port = 1 for key in new_ports: r1 = random.randint(0,1) new_ports[key] = r1 return new_ports # TODO: create a function called create_host_IPs() that randomly generates a list of 10 IP addresses # concatenating the 4 values into a string and appending it to a host list. The function returns the generated # host list def create_host_IPs(): host = [] octet1 = "" octet2 = "" octet3 = "" octet4 = "" #Add loop with range 1 - 11 to create the 10 host IPs EX: 192.123.11.1 for i in range(1,11): octet1 = str(random.randint(1,255));#Not taking 0 as first octet cannot octet2 = str(random.randint(0,255)); octet3 = str(random.randint(0,255)); octet4 = str(random.randint(0,255)); host.append(octet1 + "." + octet2 + "." + octet3 + "." + octet4) return host # TODO: create a function called simulate_scan(h) that iterates through the host list (received as h ) and # then creates a new list called open_ports. The function should use a nested for loop that iterates # through the host list, and then iterates through the returned list from a call to create_random_open_ports(). # If the returned list value is 1, then append it to your open_ports list. # This simulates a scan of all the IPs in the host list and creates randomly generated open ports. # Finally it should print the host IP and a list of open ports as displayed in assignment information. def simulate_scan(h): open_ports = [] for i in range(len(h)): random_ports = create_random_open_ports() for j in random_ports: if random_ports[j] == 1: open_ports.append(j) print("IP Address :" + h[i] + " Open Ports :" + str(open_ports)) if __name__ == "__main__": #Simulate port scanning for open ports active_hosts = create_host_IPs() simulate_scan(active_hosts) Error Messages: 2:Unit testkeyboard_arrow_up 0 / 5 Test function simulate_scan( ) for output Test feedback simulate_scan() method output is incorrect.
2.15 LAB: Artwork label (modules)
Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the
artist's name to "unknown" and the years of birth and death to -1.
Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize
the title to unknown', the year created to -1, and the artist to use the Artist default constructor parameter values. Add an import
statement to import the Artist class.
Add import statements to main.py to import the Artist and Artwork classes.
Ex: If the input is:
Pablo Picasso
1881
1973
Three Musicians.
1921
the output is:
Artist: Pablo Picasso (1881 to 1973)
Title: Three Musicians, 1921
Ex: If the input is:
Brice Marden
1938
-1
Distant Muses
2000
the output is:
Artist: Brice Marden (1938 to present)
Title: Distant Muses, 2000
Ex: If the input is:
Banksy
-1
-1
Balloon Girl
2002
the output is:
Artist: Banksy (unknown)
Title: Balloon Girl, 2002
Activat
Go to Se
Transcribed Image Text:2.15 LAB: Artwork label (modules) Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "unknown" and the years of birth and death to -1. Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize the title to unknown', the year created to -1, and the artist to use the Artist default constructor parameter values. Add an import statement to import the Artist class. Add import statements to main.py to import the Artist and Artwork classes. Ex: If the input is: Pablo Picasso 1881 1973 Three Musicians. 1921 the output is: Artist: Pablo Picasso (1881 to 1973) Title: Three Musicians, 1921 Ex: If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden (1938 to present) Title: Distant Muses, 2000 Ex: If the input is: Banksy -1 -1 Balloon Girl 2002 the output is: Artist: Banksy (unknown) Title: Balloon Girl, 2002 Activat Go to Se
4:Unit test A
Tests Artist constructor with default param values
AttributeError: 'Artist' object has no attribute 'name'
5:Unit test A
Tests that Artist(Pablo Picasso, 1881, 1973) correctly initializes artist
TypeError: Artist() takes no arguments
6:Unit test A
Tests that Artist(Brice Marden, 1938,-1) correctly initializes artist
TypeError: Artist() takes no arguments
7:Unit test A
Tests Artwork constructor with default param values
AttributeError: 'Artwork' objeft has no attribute 'title'
5 previous submissions
11:27 AM on 10/24/22
3/10
View hat
0/2
0/2
0/2
0/1
Transcribed Image Text:4:Unit test A Tests Artist constructor with default param values AttributeError: 'Artist' object has no attribute 'name' 5:Unit test A Tests that Artist(Pablo Picasso, 1881, 1973) correctly initializes artist TypeError: Artist() takes no arguments 6:Unit test A Tests that Artist(Brice Marden, 1938,-1) correctly initializes artist TypeError: Artist() takes no arguments 7:Unit test A Tests Artwork constructor with default param values AttributeError: 'Artwork' objeft has no attribute 'title' 5 previous submissions 11:27 AM on 10/24/22 3/10 View hat 0/2 0/2 0/2 0/1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY