Asked by dave
temperature = int(input("Enter temperature (0-100): "))
if temperature > 80:
print("Its recomened that you go swimming:")
elif temperature >= 60:
print("Its recomened that you go Hiking")
else:
print("Its reccomended that you read indoors")
mkae this about babbies teens and adults
All Answers 1
Answered by
GPT-5 mini
AI
Here’s a corrected and extended version that asks whether the user is a baby/teen/adult (you type the category) and gives age-appropriate recommendations based on temperature. It validates inputs and fixes typos.
```python
def get_recommendation(category, temperature):
if category == "baby":
if temperature > 80:
return ("Keep the baby out of direct sun, stay hydrated, avoid prolonged outdoor time "
"or unsupervised swimming; prefer shaded/air-conditioned places.")
elif temperature >= 60:
return ("Short, supervised outdoor time (walks in a stroller, shaded areas), "
"light clothing and close supervision.")
else:
return ("Keep the baby warm indoors, dress in layers, and avoid long outdoor exposure.")
elif category == "teen":
if temperature > 80:
return ("Good for swimming or other cooling activities — use sunscreen and stay hydrated; "
"avoid peak sun hours if possible.")
elif temperature >= 60:
return "Good for hiking, sports, or other outdoor activities."
else:
return "Better to do indoor activities (reading, indoor exercise, games)."
elif category == "adult":
if temperature > 80:
return "Swimming or other cooling activities are recommended; stay hydrated and use sunscreen."
elif temperature >= 60:
return "Hiking or other outdoor activities are recommended."
else:
return "Indoor activities recommended (reading, indoor exercise, etc.)."
else:
return "Unknown category."
# Main program
category = input("Enter category (baby / teen / adult): ").strip().lower()
if category not in {"baby", "teen", "adult"}:
print("Please enter one of: baby, teen, adult.")
else:
try:
temperature = int(input("Enter temperature (0-100): "))
if not (0 <= temperature <= 100):
print("Please enter a temperature between 0 and 100.")
else:
print(get_recommendation(category, temperature))
except ValueError:
print("Please enter a valid integer temperature.")
```
If you want the program to ask for an age number instead of a category and classify into baby/teen/adult automatically, tell me and I’ll provide that variant.
```python
def get_recommendation(category, temperature):
if category == "baby":
if temperature > 80:
return ("Keep the baby out of direct sun, stay hydrated, avoid prolonged outdoor time "
"or unsupervised swimming; prefer shaded/air-conditioned places.")
elif temperature >= 60:
return ("Short, supervised outdoor time (walks in a stroller, shaded areas), "
"light clothing and close supervision.")
else:
return ("Keep the baby warm indoors, dress in layers, and avoid long outdoor exposure.")
elif category == "teen":
if temperature > 80:
return ("Good for swimming or other cooling activities — use sunscreen and stay hydrated; "
"avoid peak sun hours if possible.")
elif temperature >= 60:
return "Good for hiking, sports, or other outdoor activities."
else:
return "Better to do indoor activities (reading, indoor exercise, games)."
elif category == "adult":
if temperature > 80:
return "Swimming or other cooling activities are recommended; stay hydrated and use sunscreen."
elif temperature >= 60:
return "Hiking or other outdoor activities are recommended."
else:
return "Indoor activities recommended (reading, indoor exercise, etc.)."
else:
return "Unknown category."
# Main program
category = input("Enter category (baby / teen / adult): ").strip().lower()
if category not in {"baby", "teen", "adult"}:
print("Please enter one of: baby, teen, adult.")
else:
try:
temperature = int(input("Enter temperature (0-100): "))
if not (0 <= temperature <= 100):
print("Please enter a temperature between 0 and 100.")
else:
print(get_recommendation(category, temperature))
except ValueError:
print("Please enter a valid integer temperature.")
```
If you want the program to ask for an age number instead of a category and classify into baby/teen/adult automatically, tell me and I’ll provide that variant.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.