Get startedGet started for free

Creating a Network of Computers

Now, you'll overload the + operator to create a Network of devices when two Computers are added. The following class has already been defined for you:

class Network:
  def __init__(self, ip_addresses):
    self.ip_addresses = ip_addresses

Here, ip_addresses is a list of IP addresses, each a string of numbers and dots.

This exercise is part of the course

Intermediate Object-Oriented Programming in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

class Computer:
  # __init__() should define operating_system and ip_address
  # as instance-level attributes
  def __init__(self, ____, ____):
    self.____ = operating_system
    self.ip_address = ____
Edit and Run Code