<jupyter_start><jupyter_text>![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Unit 4 Lab: Debugging OverviewWelcome to the Unit 4 lab!Imagine that your lab partner just asked you to review their code from Lab 3 to help them fix some bugs. Work through the following bugs to help them out.---  InstructionsFix the code in each of the sections below to get it running properly.  Bug 1---<jupyter_code>one_day_of_hourly_temperatures = [67,67,68,69,71,73,75,76,79,81,81,80,82,81,81,80,78,75,72,70,67,65,66,66]
one_day_of_hourly_humidity = [60,65,65,70,70,70,70,75,75,75,75,80,80,85,85,85,85,80,80,80,80,80,80,80]
one_day_of_hourly_rainfall = [0,0,0,0.1,0.1,0.05,0.1,0.15,0.2,0.3,0.3,0.5,0,0,0,0,0,0,0,0,0,0,0,0]

# Fix the bug in the code below:
weather_data = []
for i in one_day_of_hourly_temperatures:
    current_hour = {
        "hour": i,
        "temperature": one_day_of_hourly_temperatures[i],
        "humidity": one_day_of_hourly_humidity[i],
        "rainfall": one_day_of_hourly_rainfall[i]
    }
    weather_data.append(current_hour)

for hour in weather_data:
    print(hour)<jupyter_output><empty_output><jupyter_text>Bug 2<jupyter_code>one_day_of_hourly_temperatures = [67,67,68,69,71,73,75,76,79,81,81,80,82,81,81,80,78,75,72,70,67,65,66,66]
one_day_of_hourly_humidity = [60,65,65,70,70,70,70,75,75,75,75,80,80,85,85,85,85,80,80,80,80,80,80,80]
one_day_of_hourly_rainfall = [0,0,0,0.1,0.1,0.05,0.1,0.15,0.2,0.3,0.3,0.5,0,0,0,0,0,0,0,0,0,0,0,0]

# Fix the bug in the code below:
weather_data = []
for i in range(len(one_day_of_hourly_tepmeratures)):
    current_hour = {
        "hour": i,
        "temperature": one_day_of_hourly_temperatures[i],
        "humidity": one_day_of_hourly_humidity[i],
        "rainfall": one_day_of_hourly_rainfall[i]
    }
    weather_data.append(current_hour)

for hour in weather_data:
    print(hour)<jupyter_output><empty_output><jupyter_text>Bug 3---<jupyter_code># Fix the bug in the code below:
class Forecast():
    
    def __init__(location):
        self.location = location

test = Forecast("Austin, TX")<jupyter_output><empty_output><jupyter_text>Bug 4---<jupyter_code># Fix the bug in the code below:
class Forecast():
    
    def __init__(self, location):
        self.location = location
    
    def get_daily_high(self):
        return max(one_day_of_hourly_temperatures)
    
    def get_daily_low(self):
        return min(one_day_of_hourly_temperatures)
    
    def get_daily_chance_of_rain(self):
        number_of_years_of_data = 0
        times_it_has_rained = 0
        
        if sum(one_day_of_hourly_rainfall):
            times_it_has_rained += 1
            
        return times_it_has_rained / number_of_years_of_data * 100


test = Forecast("Austin,TX")
print("High:", test.get_daily_high())
print("Low:", test.get_daily_low())
print("Chance of Rain:", test.get_daily_chance_of_rain(),'%')<jupyter_output><empty_output><jupyter_text>Bug 5: The Daily Forecast Is Not Displaying Correctly---<jupyter_code># Fix the bug in the code below:
class Forecast():
    
    def __init__(self, location):
        self.location = location
    
    def get_daily_high(self):
        return max(one_day_of_hourly_temperatures)
    
    def get_daily_low(self):
        return min(one_day_of_hourly_temperatures)
    
    def get_daily_chance_of_rain(self):
        number_of_years_of_data = 10
        times_it_has_rained = 0
        
        if sum(one_day_of_hourly_rainfall):
            times_it_has_rained += 1
            
        return times_it_has_rained / number_of_years_of_data * 100
    
    def display_daily_forecast(self):
        print(f"The weather forecast for today in {location} is: \
High of {get_daily_high()}, Low of {get_daily_low()}, with a {get_daily_chance_of_rain()}% chance of rain.")
    

test = Forecast("Austin,TX")
test.display_daily_forecast()<jupyter_output><empty_output><jupyter_text>Bug 6: The Daily High Is Incorrect — Fix the Logic in the `get_daily_high()` Method---Expected 82, returned 66.<jupyter_code># Fix the bug in the code below:
class Forecast():
    
    
    def __init__(self, location):
        self.location = location
    
    def get_daily_high(self):
        daily_high = 0
        for i in range(len(one_day_of_hourly_temperatures)):
            daily_high = one_day_of_hourly_temperatures[i]
            if(one_day_of_hourly_temperatures[i] > daily_high):
                daily_high = one_day_of_hourly_temperatures[i]
        return daily_high
    
    def get_daily_low(self):
        return min(one_day_of_hourly_temperatures)
    
    def get_daily_chance_of_rain(self):
        number_of_years_of_data = 10
        times_it_has_rained = 0
        
        if sum(one_day_of_hourly_rainfall):
            times_it_has_rained += 1
            
        return times_it_has_rained / number_of_years_of_data * 100
    
    def display_daily_forecast(self):
        print(f"The weather forecast for today in {self.location} is: \
High of {self.get_daily_high()}, Low of {self.get_daily_low()}, with a {self.get_daily_chance_of_rain()}% chance of rain.")
    

test = Forecast("Austin,TX")
test.display_daily_forecast()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1135145482388974, 'fraction_numerical': 0.061064318529862174, 'mean_word_length': 3.8786181139122315, 'pattern_counts': {'":': 8, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '541682', 'license': 'MIT', 'n_tokens_mistral': 2206, 'n_tokens_neox': 1980, 'n_words': 344, 'path': 'unit-4-troubleshooting/instructor-resources/18-unit-lab-4/pyth621-day3-lab-debugging-students.ipynb', 'repo_name': 'rodriguezda/python-programming-104', 'size': '5224'}