exam questions

Exam 98-381 All Questions

View all questions & answers for the 98-381 exam

Exam 98-381 topic 1 question 4 discussion

Actual exam question from Microsoft's 98-381
Question #: 4
Topic #: 1
[All 98-381 Questions]

HOTSPOT -
You are designing a decision structure to convert a student's numeric grade to a letter grade. The program must assign a letter grade as specified in the following table:

For example, if the user enters a 90, the output should be, "Your letter grade is A". Likewise, if a user enters an 89, the output should be "Your letter grade is B".
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
References: https://www.w3resource.com/python/python-if-else-statements.php

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
gargaditya
Highly Voted 4 years, 7 months ago
(MISSING PART) elif grade>=65: letter_grade='D' else: letter_grade='Failed'
upvoted 7 times
...
TrevorSmit
Most Recent 2 years, 11 months ago
grade = int(input("Enter a numeric grade ")) if grade >= 90: letter_grade = 'A' print(letter_grade) elif grade >= 80: letter_grade = 'B' print(letter_grade) elif grade >= 70: letter_grade = 'C' print(letter_grade) elif grade >= 65: letter_grade = 'D' print(letter_grade) else: letter_grade = 'F' print(letter_grade)
upvoted 1 times
...
sudarchary
3 years, 7 months ago
Correct except the last part grade = int(input("ENter Grade: ")) letter_grade='' if grade >= 90: letter_grade = 'A' elif grade >= 80: letter_grade = 'B' elif grade >= 70: letter_grade = 'C' elif grade <= 69 and grade >= 65: letter_grade = 'D' else: letter_grade = 'F' print(letter_grade)
upvoted 2 times
...
Shw7
3 years, 10 months ago
Working Code: grade = int(input("ENter Grade: ")) letter_grade='' if grade > 90: letter_grade = 'A' elif grade >= 80: letter_grade = 'B' elif grade >= 70: letter_grade = 'C' if grade <= 69 and grade <= 65: letter_grade = 'D' print(letter_grade)
upvoted 3 times
...
Backups101
4 years, 6 months ago
Here's a code that I written up to this question, not even sure if this is correct, hoping to have someone explain to me why its always giving me a False Statement when I entered a Numeric Grade like (80-95), shouldn't give me a True Statement or print out "my grade is A", I've just started learning python Backups Letter Grade Convertor grade= int(input("Enter a numeric grade")) if grade >= 90: print (("My_grade") == 'A') elif grade >=80: print (("My grade")== "B")
upvoted 1 times
sadako11
4 years, 5 months ago
The output strings you are trying to print are wrong. Try: grade= int(input("Enter a numeric grade")) if grade >= 90: print ("My grade = A") elif grade >=80: print ("My grade = B") Remember when u use a double == is to evaluate boolean expressions . Boolean expressions returns True or False.
upvoted 5 times
...
...
nowisthetime
4 years, 10 months ago
Valid answer. last part is cut off.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...