- Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
- Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
- OverflowAI GenAI features for Teams
- OverflowAPI Train & fine-tune LLMs
- Labs The future of collective knowledge sharing
- About the company Visit the blog
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Get early access and see previews of new features.
IT 140 project 2
I have been working on my video game for my class project and we are using dictionaries in order to create a videogame story board. My current code allows me to move rooms just fine but the only item it is adding is the word 'item' into the inventory. I am still in the preliminary steps and I am more curious than stuck on why the coding is acting this way.
- 1 A Stack Overflow question should be about the specific technical problem that prevents you from completing your project successfully, not about the project itself. See How do I ask and answer homework questions? . Code that's unrelated to the problem (like printing instructions) should be refactored out before asking a question, as per minimal reproducible example guidelines. – Charles Duffy Commented Apr 15, 2022 at 16:16
- 1 What is your question? What happens when you run the code, and what did you expect to happen instead? Any errors? – Robert Commented Apr 15, 2022 at 16:17
- 2 Your minimal reproducible example should also contain the minimal inputs necessary to reproduce the error or problem. I would assume it's because you are appending the command to your list, not the value tied to the item key, but we can't know that without knowing what you are entering – G. Anderson Commented Apr 15, 2022 at 16:19
- 1 Look at your code. You are adding command to the inventory_items , and the command is always going to be item . – Tim Roberts Commented Aug 13, 2023 at 2:10
2 Answers 2
if command in rooms[current_room]: will only allow you to enter one of the keys of the dictionary for the current room. Since the item names are in the value of the item key, not the key itself, you can't enter an item name there.
You could split this into two commands -- first the user enters something like take , then you prompt for the name of the item and check that it's in the item element.
I think one way to handle this would be to define a function for retrieving an item, as so, and rather than using
This well remove the corresponding item after retrieval.
Also for prompting for input, and input validation, you could try this(just capitalize all Key-Value pairs in your dictionary):
The title method of course returns a copy of the string in which the first letters are capitalized, and .split() arranges the input entry as a List[] of strings. You could handle movement in a manner such as "go east", or whichever direction. And for retrieving an item using "get" item:
Hope this helps!
Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Sign up or log in
Post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .
Not the answer you're looking for? Browse other questions tagged python or ask your own question .
- The Overflow Blog
- Community Products Roadmap Update, October 2024
- Meet the AI native developers who build software through prompt engineering
- Featured on Meta
- Preventing unauthorized automated access to the network
- Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
- Feedback Requested: How do you use the tagged questions page?
- Proposed designs to update the homepage for logged-in users
Hot Network Questions
- Airport security confiscated umbrella
- Producing solo work
- Is there any hermeneutical principle that would determine how much of Job's friends' speeches should be taken as divine instruction?
- Is it legal to record a busy public street, use facial recognition and then sell access to archived footage?
- Are tyres truly the best upgrade for a bike?
- What does it mean for the eye to grow old because of enemies?
- Were US men and women ever so divided in national polls?
- Why do fine-tooth blades smoke more than other blades when cutting thicker wood?
- Triangulable versus trianguable
- During WWII, did the Allies know about the location and significance of the Wolf's Lair? If so, why did they not attack it?
- I need help with this indirect rule question. I can’t seem to figure it out and it’s the last one in my lab if anyone can help me!
- Did Kant actually read Aristotle or did he just become aware of it indirectly through commentators?
- Is the anthropic principle a "cop-out"?
- Ubuntu Pro: How does the updating process work?
- Help understanding NEC requirements for junction box access
- Why should one use globs over regex when doing filename pattern matching?
- Does it make sense to mature a gluten-free flour?
- Is every connected subgroup of a Euclidean space closed?
- Why can I define a std::string instance that is constinit? Isn't constinit forbidden if an object requires dynamic initialization?
- Are 'proportional' and 'proportionate' slightly different in usage?
- Concocting a fourth spatial dimension that can support wormhole-like travel and not mess up life?
- Does any physical entity last forever?
- Calculate optimal game upgrades
- What is the fastest fixed landing gear airplane?
# Project Stem
Source code for the 2022-23 AP Computer Science A course on Project Stem.
# 📃 About
This page contains the source code to various problems on Project Stem. Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available).
The provided source code is intended to work with the 2023 AP CS A course. These solutions may grow out-of-date as new changes are made to the course every year.
# Table of Contents
- Unit 1: Primitive Types
- Unit 2: Using Objects
- Unit 3: Boolean Expressions and If Statements
- Unit 4: Iteration
- Unit 5: Writing Classes
- Unit 6: Array
- Unit 7: ArrayList
- Unit 8: 2D Array
- Unit 9: Inheritance
- Unit 10: Recursion
# 📝 Contributing
Notice a typo or error? Feel free to create an issue !
Please note that support will not be provided for code that does not work in newer lessons.
- How it works
- Homework answers
Answer to Question #87539 in Python for Timothy
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Leave a comment
Ask your question, related questions.
- 1. Assume there is a variable, h already associated with a positive integer value. Write the code neces
- 2. For this lab you will find the area of an irregularly shaped room with the shape as shown above.
- 3. A king has 100 servants, then he decides that he wants only one servant: He numbers them from 1 to
- 4. Enter a name: Grace Enter an adjective: stinky Enter an adjective: blue Enter an adverb: quietly
- 5. How do you build a website?
- 6. Given the string, s, and the list, lst, associate the variable contains with True if every string in
- 7. Ask the user to input an integer. Print out the next three consecutive numbers.
- Programming
- Engineering
Who Can Help Me with My Assignment
There are three certainties in this world: Death, Taxes and Homework Assignments. No matter where you study, and no matter…
How to Finish Assignments When You Can’t
Crunch time is coming, deadlines need to be met, essays need to be submitted, and tests should be studied for.…
How to Effectively Study for a Math Test
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
Navigation Menu
Search code, repositories, users, issues, pull requests..., provide feedback.
We read every piece of feedback, and take your input very seriously.
Saved searches
Use saved searches to filter your results more quickly.
To see all available qualifiers, see our documentation .
- Notifications You must be signed in to change notification settings
Latest commit
File metadata and controls.
APCSA Project Stem
Source code for the 2022-23 AP Computer Science A course on Project Stem. Browse the source code »
This repository contains the source code to various problems on Project Stem. Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available).
The provided source code is intended to work with the 2023 AP CS A course. These solutions may grow out-of-date as new changes are made to the course every year.
The user-friendly website front-end found here is built using Retype .
Table of Contents
- Unit 1: Primitive Types
- Unit 2: Using Objects
- Unit 3: Boolean Expressions and If Statements
- Unit 4: Iteration
- Unit 5: Writing Classes
- Unit 6: Array
- Unit 7: ArrayList
- Unit 8: 2D Array
- Unit 9: Inheritance
- Unit 10: Recursion
📝 Contributing
Notice a typo or error? Feel free to create an issue !
Please note that support will not be provided for code that does not work in newer lessons. As such, the source code will not be updated to reflect newer curricula.
This repository is licensed under GPL 3.0 .
IMAGES
VIDEO
COMMENTS
Amahle is trying to communicate the structural information about the data used by her software to a Python coder, a Java coder, and a C++ coder. Which The following code has which kind of error? ```python total = 0 x = 0 while x < 10: total = total + x x = x + 1 ``` A. syntax B. runtime C. logic
Our experts will gladly share their knowledge and help you with programming projects. Keep up with the world's newest programming trends. ... Answer to Question #96157 in Python for Assignment 2: Room Area 2019-10-08T09:57:57-04:00. Answers > Programming & Computer Science > Python.
Assignment 2: Room Area Quizlet has study tools to help you learn anything. Improve your grades and reach your goals with flashcards, practice tests and expert-written solutions today.
Assignment 2: Room Area unit 2 I suck at math but there ya go, figured it out Share Add a Comment. Be the first to comment Nobody's responded to this post yet. Add your thoughts and get the conversation going. Top 69% Rank by size . More posts you may like Top Posts Reddit ...
Source code for the 2022-23 AP Computer Science A course on Project Stem. - ricky8k/APCSA-ProjectStem
My first recommendation is to check out the Python style guide, called pep8). Most Python developers stick to this, and it will make your life easier when trying to communicate with us. Next, you want to adjust your expectations. Trying to parse out a bunch of values from something like: Wall 1 3x4 Wall 2 5x9 Wall 3 9x9 Door 1 2x6.5 Door 2 2x6.5
This repository contains the source code to various problems on Project Stem. Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available). Note The provided source code is ...
PYTHON- Projects in my MAT-243 STATS for STEM I course at SNHU (HTML files and Python files with source code and reports) - MAT243-Applied-Statistics-for-STEM-I/Project 2/Project Two Jupyter Script.py at master · Lunarestia/MAT243-Applied-Statistics-for-STEM-I.
if command in rooms[current_room]: will only allow you to enter one of the keys of the dictionary for the current room. Since the item names are in the value of the item key, not the key itself, you can't enter an item name there.. You could split this into two commands -- first the user enters something like take, then you prompt for the name of the item and check that it's in the item element.
Study with Quizlet and memorize flashcards containing terms like In Python, using "+" between 2 numbers means:, In Python, using "+" between 2 strings means:, If x = 12 and y = 4, what is the output of: print(x + y) ? and more. ... Unit 2 Project Stem. 5.0 (2 reviews) Flashcards; Learn; Test; Match; Q-Chat; Get a hint. In Python, using ...
14%9 returns 5. 16%2 returns 8. 2%16 returns 2. array.insert (i, x) adds the (x) in the array at (i) without removing what was already there. remove. removes the first occurrence of the element in a list. Function. A function is a collection of instructions that the program will execute.
If anyone has the answers to 1.5-1.9 in project stem that would be a big help🙏 Share Add a Comment. Sort by: ... CrazyNcaustiC • Does anybody have CS Python Fundamentals AFE 1.5 Code Practice: Question 1 Reply reply More posts you may like Top Posts Reddit . reReddit: Top posts of February 17, 2022. Reddit . reReddit: Top posts of February ...
Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available). The provided source code is intended to work with the 2023 AP CS A course. These solutions may grow out-of-date as new changes are made to the course every year.
Our experts will gladly share their knowledge and help you with programming projects. Keep up with the world's newest programming trends. ... Answer to Question #87539 in Python for Timothy 2019-04-04T06:28:50-04:00. Answers > Programming & Computer Science > Python. Question #87539. Assignment 2: Room Area Room shape For this lab you will ...
Find an answer to your question assignment 2: room area CS python fundamentals project stem ... Assignment 2: room area CS python fundamentals project stem ... The _____ tool appends multiple data streams into one unified steam. The tool accepts multiple inputs based on either fleld name or record position.
Which of the following are tasks carried out by the compiler? Checks code for mistakes. Translate commands into binary machine code. 16. Which part of the computer are instructions carried out? CPU. answers for project stem cs python fundamentals, quiz 1 and assignment 1 included Learn with flashcards, games, and more — for free.
This repository contains the source code to various problems on Project Stem. Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available). Note.
Action Movies & Series; Animated Movies & Series; Comedy Movies & Series; Crime, Mystery, & Thriller Movies & Series; Documentary Movies & Series; Drama Movies & Series