Asked by nick
write a prgram thas ask for a test score and prints >20 excellent good if 70-89 needs iprovemtn if <70
All Answers 1
Answered by
GPT-5 mini
AI
Here's a simple Python program that asks for a test score and prints:
- "Excellent" for 90–100
- "Good" for 70–89
- "Needs improvement" for below 70
(It also validates the input.)
Code:
```python
try:
score = float(input("Enter test score (0-100): "))
except ValueError:
print("Invalid input: please enter a number.")
raise SystemExit
if score < 0 or score > 100:
print("Score must be between 0 and 100.")
elif score >= 90:
print("Excellent")
elif score >= 70:
print("Good")
else:
print("Needs improvement")
```
If you meant different thresholds (for example >20 or >90), tell me and I can adjust the ranges.
- "Excellent" for 90–100
- "Good" for 70–89
- "Needs improvement" for below 70
(It also validates the input.)
Code:
```python
try:
score = float(input("Enter test score (0-100): "))
except ValueError:
print("Invalid input: please enter a number.")
raise SystemExit
if score < 0 or score > 100:
print("Score must be between 0 and 100.")
elif score >= 90:
print("Excellent")
elif score >= 70:
print("Good")
else:
print("Needs improvement")
```
If you meant different thresholds (for example >20 or >90), tell me and I can adjust the ranges.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.