Skip to content

Instantly share code, notes, and snippets.

@santiagobasulto
Last active June 13, 2017 00:27
Show Gist options
  • Save santiagobasulto/f33f2b9eaceb083bdf51ebd15a950497 to your computer and use it in GitHub Desktop.
Save santiagobasulto/f33f2b9eaceb083bdf51ebd15a950497 to your computer and use it in GitHub Desktop.
  1. Create a "Car" class that has the following attributes: brand, model, year, price. Create several car objects with different attributes.

  2. Add those cars objects to a cars list. Using a for loop print each one of the cars in the following format: "Tesla - Model S - 2017 - $81.000

  3. Create a class CarManufacturer. Set the values name and country_origin. For example, name="Tesla", country_origin="US".

  4. Modify the cars so now instead of taking a plain string as a name, they take an object of type CarManufacturer.

  5. Modify the for-loop previously created to use the name attribute of the car manufacturer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment