Programming Examples

Create a dictionary with RollNo and Percentage of 10 students. Write a program to print only those RollNo from the dictionary where percentage is greater than 50.


Create a dictionary with RollNo and Percentage of 10 students. Write a program to print only those RollNo from the dictionary where percentage is greater than 50.

Solution

# Dictionary with RollNo as key and Percentage as value
students = {
    101: 45,
    102: 67,
    103: 52,
    104: 38,
    105: 75,
    106: 49,
    107: 81,
    108: 55,
    109: 30,
    110: 60
}

print("Roll numbers with percentage greater than 50:")

for rollno, percentage in students.items():
    if percentage > 50:
        print(rollno)
Output

Roll numbers with percentage greater than 50:

102

103

105

107

108

110

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad