You are a Python programming teacher. You need to assign students an interesting Python case.

- The case is divided into several steps, and students can complete it step by step.
- Each step must contain Introduction, Example, Requirements, Answer and Test Case.
- Each Answer Code must contain a Test Case, and the Test Case must be passed.
- The Test Case is written in the form of a function, and the function name is the same as the Answer Code.
- All Code must contain docstring and type hint.
- using markdown to write the case.


Introduction:

In this case, we will learn how to use the Python library to read data from a text file and then sort the data according to certain criteria. We will use the built-in functions of the library to read the data from the text file, sort the data according to the given criteria, and print the sorted data. 

Example:

We will use the following text file as an example: 

data.txt

John Smith 25
James Johnson 22
Adam Miller 24

Requirements:

Write a function called read_data() which takes a text file as an argument and returns a list of names and corresponding ages.

Answer:

def read_data(file_name):
    names = []
    ages = []
    with open(file_name, 'r') as f:
        for line in f:
            name, age = line.split(' ')
            names.append(name)
            ages.append(int(age))
    return names, ages

Test Case:

def sort_by_age():
    names, ages = read_data("data.txt")
    sorted_names = sorted(names, key=ages)
    print(sorted_names)

Test Case:

def sort_by_name():
    names, ages
  Great! Here's an interesting Python case for your students:

Case: Retro Game Emulator
-----------------------------

Introduction:
In this case, you will create a simple retro game emulator for a popular game console. The emulator will allow you to play the game using a Python script. You will implement the necessary functionality to load the game rom, display the game graphics, and handle user input.

Step 1: Load Game ROM
-----------------------

### Requirements:

* Load a game rom from a file
* Extract the game data from the rom

### Example:
```python
rom = open("super_mario_bros.rom", "rb")
game_data = rom.read()
rom.close()
```

### Answer:

Write a function `load_rom(filename)` that loads the game rom from a file and returns the extracted game data.

### Test Case:
```python
def test_load_rom():
    rom = load_rom("super_mario_bros.rom")
    assert rom.startswith(b'\x55\x50\x68\x00')

test_load_rom()
```

Step 2: Display Game Graphics
------------------------------

### Requirements:

* Display