Masala #JNM7RS9I0U

Xotira 32 MB Vaqt 1000 ms
14

History

Consider the following table that lists some notable empires in history along with their year of birth and year of death:

| Empire               | Year of Birth | Year of Death |
|----------------------|---------------|---------------|
| Roman Empire         | -27           | 476           |
| Ottoman Empire       | 1299          | 1922          |
| Mongol Empire        | 1206          | 1368          |
| British Empire       | 1583          | 1997          |
| Egyptian Empire      | 3100          | 30            |
| Inca Empire          | 1438          | 1533          |
| Byzantine Empire     | 330           | 1453          |
| Maurya Empire        | 322           | 185           |
| Aztec Empire         | 1325          | 1521          |
| Persian Empire       | 550           | 330           |
| Mughal Empire        | 1526          | 1857          |
| Greek Empire         | -336          | -146          |
| Chinese Empire       | -221          | 1912          |
| Russian Empire       | 1721          | 1917          |
| Achaemenid Empire    | 550           | 330           |
| Carthaginian Empire  | 814           | 146           |
| Holy Roman Empire    | 962           | 1806          |
| Gupta Empire         | 240           | 550           |
| Byzantine Empire     | 395           | 1453          |
| Sasanian Empire      | 224           | 651           |

Kiruvchi ma'lumotlar:

You will be given a year.

 


Chiquvchi ma'lumotlar:
Write a Python program that takes a year as input and determines which empire(s) were born or died in that year. If multiple empires match the criteria, the program should display all of them.

Misollar
# input.txt output.txt
1
100
Empire(s) born or died in 100:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
The year 100 is in the middle of Egyptian Empire and Inca Empire
2
307
Empire(s) born or died in 307:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
| Gupta Empire         | 240             | 550             |
| Sasanian Empire      | 224             | 651             |
The year 307 is in the middle of Egyptian Empire and Inca Empire
The year 307 is in the middle of Maurya Empire and Aztec Empire
The year 307 is in the middle of Carthaginian Empire and Holy Roman Empire
3
1761
Empire(s) born or died in 1761:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Ottoman Empire       | 1299            | 1922            |
| British Empire       | 1583            | 1997            |
| Mughal Empire        | 1526            | 1857            |
| Chinese Empire       | -221            | 1912            |
| Russian Empire       | 1721            | 1917            |
| Holy Roman Empire    | 962             | 1806            |
4
173
Empire(s) born or died in 173:
| Empire               | Year of Birth   | Year of Death   |
|----------------------|-----------------|-----------------|
| Roman Empire         | -27             | 476             |
| Chinese Empire       | -221            | 1912            |
The year 173 is in the middle of Egyptian Empire and Inca Empire
The year 173 is in the middle of Carthaginian Empire and Holy Roman Empire