Starting from:

$25

Closed Lab 5- mountain


Description: A bad day in the mountains is better than a good day just about anywhere
else. Unless you fall off of the mountain. But that’s not really a bad day, that’s a
really, really terrible day. So let’s assume that you don’t fall off of the mountain. In
that case, mountains are the bees knees. So for this assignment, you are going to create
a Python class called Mountain. A mountain has the following instance attributes:
Attribute Type
name string
elevation integer
prominence integer
latitude tuple
longitude tuple
climbed boolean
climed is initially False for all instances. In addition, the Mountain class has a class
variable called num mountains. The class should live in a file called mountain.py.
Your class also needs some methods. Below is a list:
• init creates a Mountain instance
1
• del does required housekeeping when an instance is deleted
• print pretty prints a mountain instance
• is higher takes an additional mountain as a parameter. Returns True if the
distinguished parameter has a higher elevation than the second parameter, False
otherwise.
• climb sets the climbed attribute to True.
When your class is complete, create a file called mountain driver.py. In this file, write
a program that creates a list of Mountain instances. The list is called swiss mountains.
Your program will read the contents of the file mountains.txt. Each line of the file
contains the relevant data for one stunningly beautiful hunk of granite. Populate the
list with the mountains and test all of the methods in the class.
2

More products