Examsadd new result

You want to add a new result to an exam. Here's a simple way to do it:

Assuming you have a list of exam results

Let's say you have a list of exam results in a Python dictionary, where each key is a student's name and each value is their exam score:

exam_results = {
    "John": 80,
    "Jane": 90,
    "Bob": 70,
    "Alice": 95
}

Adding a new result

To add a new result, you can simply add a new key-value pair to the dictionary:

exam_results["Charlie"] = 85

Now, the updated dictionary looks like this:

exam_results = {
    "John": 80,
    "Jane": 90,
    "Bob": 70,
    "Alice": 95,
    "Charlie": 85
}

Printing the updated results

You can print the updated results using a loop:

for student, score in exam_results.items():
    print(f"{student}: {score}")

This will output:

John: 80
Jane: 90
Bob: 70
Alice: 95
Charlie: 85

That's it! You've successfully added a new result to the exam.