Tuse makyt\ApPpbat \ProgramS \Python sers/maky C/py Akhenaten is one of the most feared pharaohs of Egypt and he is ready to take over the world. You as the Medjay have to prevent Akhenaten from taking over the world by gathering all of the artifacts to banish him from the land of the living. You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal. You will be transported to one of these ancient Egypt locations based on your decision of movement of North, East, South, West. The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak, Abydos Temple, Hamuaptra, Am-shere, and Alexandria. The artifacts that you will be needing to collect are: Canopic jars, The book of the dead, amulet, a Sarcophagus, Short Swords, and Scarabs. Whith the artifacts that you collect you are able to banishing him, from the land of the living and preventing resurrection. You are in the Alexandria. Inventory: [] You see a

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
C:\Users\makyl\AppData\Local\Programs\Python\Python310\python.exe C:/Users/makyl/pythonProject2/TextBasedGame.py
Akhenaten is one of the most feared pharaohs
Egypt and he is ready to take over the world.
You as the Medjay have to prevent Akhenaten from taking over the world by gathering all of the artifacts to
banish him from the land of the living.
You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal.
You will be transported to one of these ancient Egypt locations based on your decision of movement of
North, East, South, West.
The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak,
Abydos Temple, Hamuaptra, Am-shere, and Alexandria.
The artifacts that you will be needing to collect are:
Canopic jars, The book of the dead, amulet, a Sarcophagus, Short Swords, and Scarabs.
Whith the artifacts that you collect you are able to banishing him,
from the land of the living and preventing resurrection.
You are in the Alexandria.
Inventory: []
You see a
Egypt locations:
Which portal would you like? (North, East, South, West.)South
Traceback (most recent call last):
File "C:\Users\makyl\pythonProject2\TextBasedGame.py", line 74, in <module>
command = command.split() [1]
IndexError: list index out of range
Process finished with exit code 1
Transcribed Image Text:C:\Users\makyl\AppData\Local\Programs\Python\Python310\python.exe C:/Users/makyl/pythonProject2/TextBasedGame.py Akhenaten is one of the most feared pharaohs Egypt and he is ready to take over the world. You as the Medjay have to prevent Akhenaten from taking over the world by gathering all of the artifacts to banish him from the land of the living. You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal. You will be transported to one of these ancient Egypt locations based on your decision of movement of North, East, South, West. The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak, Abydos Temple, Hamuaptra, Am-shere, and Alexandria. The artifacts that you will be needing to collect are: Canopic jars, The book of the dead, amulet, a Sarcophagus, Short Swords, and Scarabs. Whith the artifacts that you collect you are able to banishing him, from the land of the living and preventing resurrection. You are in the Alexandria. Inventory: [] You see a Egypt locations: Which portal would you like? (North, East, South, West.)South Traceback (most recent call last): File "C:\Users\makyl\pythonProject2\TextBasedGame.py", line 74, in <module> command = command.split() [1] IndexError: list index out of range Process finished with exit code 1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

This is the code I keep getting several errors. I don't know what I am doing wrong it has to move from room to room pick up items and stay in inventory.

rooms = {'Alexandria': {'name':'Alexandria','South': 'Nile', 'North': 'Pyramids of Giza', 'East': 'Abydos Temple', 'West': 'Am-shere', 'text':'Alexandria'},

'Nile': {'name':'Nile', 'North': 'Alexandria', 'East': 'Karnak', 'item': 'Amulet', 'text':'Nile'},

'Am-shere': {'name':'Am-shere','East': 'Alexandria', 'item': 'Canopic jars', 'text':'Am-shere'},

'Karnak': {'name': 'Karnak','West': 'Nile', 'item': 'Akhenaten', 'text':'Karnak'},

'Abydos temple': {'name':'Abydos temple','West': 'Alexandria', 'North': 'Cairo', 'item': 'Scarabs', 'text':'Abydos temple'},

'Cairo': {'name': 'Cairo','South': 'Abydos Temple', 'item': 'Sarcophagus', 'text':'Cairo'},

'Pyramids of Giza': {'name':'Pyramids of Giza', 'South': 'Alexandria', 'East': 'Hamuantra', 'item': 'Short Swords', 'text':'Pyramids of Giza'},

'Hamuantra': {'name':'Hamuantra', 'West': 'Pyramids of Giza', 'item': 'The Book of the Dead', 'text':'Hamuantra'}}

item = { 'Nile': 'Amulet', 'Amshere': 'Canopic jars','Karnak': 'Akhenaten', 'Abydos temple': 'Scarabs','Cairo': 'Sarcophagus','Pyramids of Giza': 'Short Swords', 'Hamuantra': 'The Book of the Dead',}

text = { 'Alexandria': 'You have just entered into a portal and you are in Alexandria.\n There is no item in this location.',

 'Nile': 'You have just entered into a portal and now you are in the Nile.\n There is the amulet it over by the tomb.',

    'Am-shere': 'You have just entered into a portal and now you are in Am-shere.\n There is the Canopic jars it is the chest near the treasure.',

    'Karnak': 'You have just entered into a portal and now you are in Karnak.\n I hope you have collected all 6 items to defeat Akhenaten.',

    'Abydos temple': 'You have just entered into a portal and now you are in Abydos Temple.\n Look at the wall there some Scarabs quick grab some.',

    'Cairo': 'You have just entered into a portal and now you are in Cairo.\n We have to look around and see if we can find a Sarcophagus.\n Found one quickly grab it and lets set it up for the ritual.\n',

    'Pyramids of Giza': 'You have just entered into a portal and now you are in Pyramids of Giza.\n Lets hurry and look around for any weapons that have been left.\n Wait! I see one near that Sarcophagus its a Short Sword.\n',

    'Hamuantra': 'You have just entered into a portal and now you are in Hamuantra.\n We have to look for the goddess basset the the book of the dead is burried beneath her.\n I see her near the entrance lets get to work and grab it.\n',}

instructions = ( 'Akhenaten is one of the most feared pharaohs of Egypt and he is ready to take over the world.\n' 'You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal.\n''You will be transported to one of these ancient Egypt locations based on your decision of movement of\n North, East, South, West.\n''The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak,\nAbydos Temple, Hamuaptra, Am-shere, and Alexandria.\n''The artifacts that you will be needing to collect are:\nCanopic jars,The book of the dead, amulet, a Sarcophagus, Short Swords,and Scarabs.\n''Whith the artifacts that you collect you are able to banishing him,\n from the land of the living and preventing resurrection.\n')

directions = ['North', 'South', 'East', 'West']

pick_up_items = ['The Book of the Dead', 'Short Swords', 'Sarcophagus', 'Scarabs', 'Canopic jars', 'Amulet', 'Akhenaten']

print(instructions)

current_room = 'Alexandria'

item_in_room = 'None'

inventory = []

while True:

    if inventory == [item]:

        print('Congratulations! You collected all the items, you are ready for Karnak')

    elif current_room == 'karnak':

        print('You have collected all of the items!. That are needed to send Akhenaten back to the underworld!')

        print('A bolt of magic streaks towards you and your vision goes black..... Game Over!')

        break

    print('You are in the {}.'.format(current_room))

    print('Inventory:', inventory)

    if item_in_room:  #checks to see if there is an item in the room

        print('You see a'.format(item_in_room))

    else:

        print("You don't see anything useful")

    command = input('\nEgypt locations:\n Which portal would you like? (North, East, South, West.)')  

    if command in directions:

        if command in rooms[current_room].keys():

            command = command.split()[1]

        current_room = rooms[current_room[command]]

    else:

            print('You cant go that way!')

    if command in pick_up_items:

        command = command.split()[1]

        if command in rooms[current_room].keys():

            inventory.append(current_room['item'])

  else:

print('You cant get that item here!')

    if command == 'quit':

        print('Thanks for playing!')

        break

    else:

        print('Invalid input')

### Educational Content: Exploring Ancient Egypt in a Text-Based Game

**Directions:**
- North
- East
- South
- West
  
**Travel Locations:**
You will journey through various significant landmarks and regions in Ancient Egypt such as:
- The Nile
- Pyramids of Giza
- Cairo
- Karnak
- Abydos Temple
- Hamunaptra
- Am-shere
- Alexandria

**Artifacts to Collect:**
During your adventures, you need to collect several important artifacts:
- Canopic jars
- The Book of the Dead
- Amulet
- Sarcophagus
- Short Swords
- Scarabs

Collecting these artifacts will help you banish enemies from the land of the living and prevent their resurrection.

**Code Error Explanation:**

When running the associated Python script, an error occurred. Below is the detailed traceback and error message:

```plaintext
Traceback (most recent call last):
  File "C:\Users\makyl\pythonProject2\TextBasedGame.py", line 68, in <module>
    if item in total_items < 6:
TypeError: argument of type 'int' is not iterable
```

**Analysis of the Error:**
The script attempted to check if `item` is in `total_items`, but `total_items` is of data type `int`. This resulted in a `TypeError` because an integer cannot be iterated over (i.e., you cannot use the `in` operator with an integer).

**Process Outcome:**
The process finished with an exit code 1, indicating that an error was encountered during execution.

### Resolving the Error:
To resolve this error, `total_items` should be an iterable data type such as a list or a set. For example:

```python
total_items = [1, 2, 3, 4, 5]  # example of changing total_items to a list
if item in total_items:  # check if item is in the list of total_items
   # your code here
```

Making sure `total_items` is a list will prevent the `TypeError` and allow the code to run as expected.

---

This educational content provides insights into the historical elements of an Ancient Egypt themed text-based game and also delves into troubleshooting a common programming error, promoting both historical knowledge and coding skills development.
Transcribed Image Text:### Educational Content: Exploring Ancient Egypt in a Text-Based Game **Directions:** - North - East - South - West **Travel Locations:** You will journey through various significant landmarks and regions in Ancient Egypt such as: - The Nile - Pyramids of Giza - Cairo - Karnak - Abydos Temple - Hamunaptra - Am-shere - Alexandria **Artifacts to Collect:** During your adventures, you need to collect several important artifacts: - Canopic jars - The Book of the Dead - Amulet - Sarcophagus - Short Swords - Scarabs Collecting these artifacts will help you banish enemies from the land of the living and prevent their resurrection. **Code Error Explanation:** When running the associated Python script, an error occurred. Below is the detailed traceback and error message: ```plaintext Traceback (most recent call last): File "C:\Users\makyl\pythonProject2\TextBasedGame.py", line 68, in <module> if item in total_items < 6: TypeError: argument of type 'int' is not iterable ``` **Analysis of the Error:** The script attempted to check if `item` is in `total_items`, but `total_items` is of data type `int`. This resulted in a `TypeError` because an integer cannot be iterated over (i.e., you cannot use the `in` operator with an integer). **Process Outcome:** The process finished with an exit code 1, indicating that an error was encountered during execution. ### Resolving the Error: To resolve this error, `total_items` should be an iterable data type such as a list or a set. For example: ```python total_items = [1, 2, 3, 4, 5] # example of changing total_items to a list if item in total_items: # check if item is in the list of total_items # your code here ``` Making sure `total_items` is a list will prevent the `TypeError` and allow the code to run as expected. --- This educational content provides insights into the historical elements of an Ancient Egypt themed text-based game and also delves into troubleshooting a common programming error, promoting both historical knowledge and coding skills development.
Solution
Bartleby Expert
SEE SOLUTION
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY