Skip to content

Commit

Permalink
Add check-weather branch with new code and unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
Hbeyza committed Jan 12, 2025
1 parent 3b96921 commit 900c78c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions check_weather.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
def check_weather(weather):
"""
This function checks the type of weather and gives a response.
It accepts one parameter:
- weather: A string representing the weather (sunny, rainy, snowy, cloudy).
It prints a message based on the weather type.
"""
if weather == "sunny":
print("It's bright today!")
elif weather == "rainy":
print("Take an umbrella.")
elif weather == "snowy":
print("It’s snowing!")
elif weather == "cloudy":
print("The sky is gray.")
else:
print("I don't know this weather.")

def ask_weather():
"""
This function asks the user for the weather condition and
calls the check_weather function to respond.
It does not accept any parameters.
"""
weather = input("How is the weather? (sunny, rainy, snowy, cloudy) ").lower()
check_weather(weather)

def main():
"""
The main function is the entry point of the program.
It starts the process of asking the user for weather information.
"""
print("Let’s talk about the weather!")
ask_weather()

# Start the program
main()

0 comments on commit 900c78c

Please sign in to comment.