ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Intermediate Object-Oriented Programming in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

class Computer:
  # __init__() should define operating_system and ip_address
  # as instance-level attributes
  def __init__(self, ____, ____):
    self.____ = operating_system
    self.ip_address = ____
Editar y ejecutar código