#๐ How do you make an edit function in python
33 messages ยท Page 1 of 1 (latest)
@digital sentinel
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I'm making a grocery list system, so i want it to have an edit system. The thing is it keeps breaking the code after i put in my prompt for edit
are you getting an error?
you'll want to explain how it behaves incorrectly and how you want it to behave. other people don't know those things even if you do.
It seems to be running as I would expect on my machine
Please type 'buy', 'show', 'edit', and 'exit': buy
Please type the name of what you want to buy: carrot
Please type 'buy', 'show', 'edit', and 'exit': edit
Current groceries list: ['carrot']
What do you want to edit (type the item exactly as shown): carrot
Change 'carrot' to: carrots
Please type 'buy', 'show', 'edit', and 'exit': show
Current groceries list: ['carrots']
Please type 'buy', 'show', 'edit', and 'exit':
since your program takes user input, that's arguably part of the code and should also be shared
ideally like this, so it can simply be copy-pasted in:
buy
carrot
edit
carrot
carrots
show
I mean, what is the issue, like?
ok so not neccessarily an error but when i edit it it doesnt change the string name for example if i type
buy
carrot
edit
carrot
milk
then i input show
it wont show carrots as milk
interesting
on my machine, it is working as expected
I inputted the inputs as you gave. Are you sure you're typing them in correctly?
Have you saved the file, perhaps?
and that is 100% the file you're running?
im sure yes
ok so
can you like exit it rn if its running then input those commands then show, then paste the whole output?
that'd be syntax error on the match/case
probably didn't save the file in-between restarting the program
yeah
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.