I’m working on the weather app project, and trying to organize my code and make it cleaner.
I’m using the weather description to determine which background image to display. If description includes certain keywords, the background image is chosen.
I’m trying to capitalize the first letter in each word in the description. I try to wrap it in a function (line 42), and return the new description after it has been manipulated (split, replaced, joined). However, when I pass the function into the function that determines the background-image (line 75), I get an error.
The other question is with toggling between Celsius and Fahrenheit (line 61). I have a variable called unit that changes depending on the current unit of the temperature. If I put the variable inside the function, it will only change once to Fahrenheit, but if the variable is placed outside the function scope, it can toggle back and forth. Why does it work outside, but not inside the function?
Thanks in advance!