Solution:
It seems as though you are missing some instance variables for you class.
Explanation:
The spec requires you have one String for describing the skies (ie cloudy, sunny) and two integers that represent the low and high temperatures for the day (ie low of 23 and high of 45)
the spec says you do not have to deal with them in a constructor, yet you may if you wish.
Variables:
string for the skies
int for the low temp
int for the high temp
Functions:
get/set for skies. get should return self.skies, set should set the instance variable for the skies.
get/set for low temp. get should return self.low, set should set the instance variable for the low temp.
get/set for high temp. get should return self.high, set should set the instance variable for the high temp
Follow this below code:
class WeatherForecast():
skies = "Clear"
high = 80
low = 20
def set_skies(self, skies):
self.skies = skies
def get_skies(self):
return self.skies
def set_high(self, high):
self.high = high
def get_high(self):
return self.high
def set_low(self, value):
self.low = value
def get_low(self):
return self.low
Enter it just like this for myProgrammingLab. (Include the 'class WeatherForecast
:" part.
class WeatherForecast:
def __init__(self):
self.skies=""
self.low=0
self.high=0
def set_skies(self,skies):
self.skies = skies
def set_high(self, high):
self.high = high
def set_low(self, low):
self.low = low
def get_skies(self):
return self.skies
def get_high(self):
return self.high
def get_low(self):
return self.low