Asked by dave
core = float(input("Enter the student's score (0-100): "))
attendance = float(input("Enter attendance percentage (0-100): "))
extra_credit = input("Did the student do extra credit? (y/n): ").strip().lower() == 'y'
# honors / pass / fail using if/elif/else
if score > 90:
print("Honors")
elif score > 60:
print("Passed")
else:
print("Failed")
# example of combining conditions using and / or
# scholarship rule: either (high score and good attendance) OR extra credit
if (score > 85 and attendance >= 80) or extra_credit:
print("Qualifies for scholarship consideration")
else:
print("Does not qualify for scholarship")
redo this usin gint and not float
All Answers 1
Answered by
GPT-5 mini
AI
I assume you meant "use int, not float" and you also had a variable-name typo (you used core but then referenced score). Here's a corrected version that uses int for the inputs and fixes the logic/indentation, with simple validation for 0–100:
```python
try:
score = int(input("Enter the student's score (0-100): "))
attendance = int(input("Enter attendance percentage (0-100): "))
except ValueError:
print("Please enter whole numbers only.")
raise SystemExit
if not (0 <= score <= 100 and 0 <= attendance <= 100):
print("Values must be between 0 and 100.")
raise SystemExit
extra_credit = input("Did the student do extra credit? (y/n): ").strip().lower() == 'y'
# honors / pass / fail
if score > 90:
print("Honors")
elif score > 60:
print("Passed")
else:
print("Failed")
# scholarship rule: either (high score and good attendance) OR extra credit
if (score > 85 and attendance >= 80) or extra_credit:
print("Qualifies for scholarship consideration")
else:
print("Does not qualify for scholarship")
```
If you want different boundary behavior (e.g., treat 90 as honors or 60 as passing), tell me and I can adjust the comparisons.
```python
try:
score = int(input("Enter the student's score (0-100): "))
attendance = int(input("Enter attendance percentage (0-100): "))
except ValueError:
print("Please enter whole numbers only.")
raise SystemExit
if not (0 <= score <= 100 and 0 <= attendance <= 100):
print("Values must be between 0 and 100.")
raise SystemExit
extra_credit = input("Did the student do extra credit? (y/n): ").strip().lower() == 'y'
# honors / pass / fail
if score > 90:
print("Honors")
elif score > 60:
print("Passed")
else:
print("Failed")
# scholarship rule: either (high score and good attendance) OR extra credit
if (score > 85 and attendance >= 80) or extra_credit:
print("Qualifies for scholarship consideration")
else:
print("Does not qualify for scholarship")
```
If you want different boundary behavior (e.g., treat 90 as honors or 60 as passing), tell me and I can adjust the comparisons.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.