Find student grade from dictionary

Report a typo

Given a dictionary where the keys are student names and the values are their corresponding grades, write a program that takes the name of a student as input and prints out their grade. If the student's name is not found in the dictionary, print 'Not found'.

Sample Input 1:

Alice

Sample Output 1:

85

Sample Input 2:

Bob

Sample Output 2:

92
Write a program in Python 3
# Dictionary of student grades
student_grades = {
"Alice": 85,
"Bob": 92,
"David": 78,
"Emma": 95
}

# Get student name from user input
student_name = input()

# Check if the student name exists in the dictionary and print their grade
# TODO: Write your code here

Create a free account to access the full topic