Get startedGet started for free

Inheriting a Computer class

In this exercise, you'll practice inheritance by creating a class called Tablet. Below is the Computer class, which has been defined for you to use in the following steps.

class Computer:
  def __init__(self, software_version):
    self.software_version = software_version

  def install_app(self, app_name, app_store):
    if app_store:
      print(f"Installing {app_name} from App Store.")
    else:
      print(f"Installing {app_name} from other provider.")

  def update_software(self, new_software_version):
      self.software_version = new_software_version

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 Tablet(Computer):
  pass

# Create the my_tablet instance
____ = ____("____")

# Update my_tablet's software to version 1.1.2
my_tablet.____("____")
print(my_tablet.____)
Edit and Run Code