#๐Ÿ”’ How do you make an edit function in python

33 messages ยท Page 1 of 1 (latest)

covert pelicanBOT
#

@digital sentinel

Python help channel opened

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.

digital sentinel
#

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

small finch
#

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.

marsh citrus
# digital sentinel I'm making a grocery list system, so i want it to have an edit system. The thing...

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': 
small finch
#

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
digital sentinel
#

yeah

#

okay

marsh citrus
digital sentinel
#

buy
carrot
edit
carrot
milk

#

then i input show

#

it wont show carrots as milk

marsh citrus
#

interesting

marsh citrus
#

I inputted the inputs as you gave. Are you sure you're typing them in correctly?
Have you saved the file, perhaps?

digital sentinel
#

i have

#

i did save it

marsh citrus
#

and that is 100% the file you're running?

digital sentinel
#

im sure yes

marsh citrus
#

ok so

marsh citrus
digital sentinel
#

nvm its working

#

thanks

marsh citrus
#

ok

#

maybe you were running a py version earlier than 3.10 then idk

small finch
#

that'd be syntax error on the match/case

#

probably didn't save the file in-between restarting the program

marsh citrus
#

yeah

covert pelicanBOT
#
Python help channel closed

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.