I am try to make a choose system. I want to use the GOTO command. But it actually doesn't works. I've already installed the goto-statement in pip.
from goto import with_goto
print('Welcome to * sell system.')
print('Choose the action:\n(1) Buy *\n(2) Contact us\n(3) Exit')
# Choose the action
while action := input('> '):
if action in '1':
break
if action in '2':
print('Contact Us\n* is a brand of *')
break
if action in '3':
exit()
print('Only 1 and 2 allowed.')
# Choose the categories
if action in '1':
print('Choose categories of merchandises.\n(1) *\n(2) *')
print('Enter 0 to exit')
# Choose the merchandise (A while in a if)
while category := input('> '):
if category in '1':
label .choose_merchandises
print('Choose the merchandises.\n(1) *- *')
while merchandises := input('> '):
if merchandises in '1':
print('Title:*- *\nPrice: *\nAmount: *\nDetails:\nDo you wanna buy it?\n(y/n)')
while wannabuy := input('> '):
if wannabuy == "y":
print('Redirecting to pay...')
break
if wannabuy == "n":
goto .choose_merchandises
print('Only y or n allowed.')
print ('1')
if category in '2':
print('2')
break
print('Only 1 and 2 allowed.')
And it told me
Traceback (most recent call last):
File "d:\*\*.py", line 18, in <module>
label .choose_merchandises
NameError: name 'label' is not defined
How can I do. Appreciate.
Patch: I am a beginner of python. It is a choosing system in that people can do what they want to do, like contact us, buy some stuff, etc. At first, users choose the action like Buy some stuff, contact us. Users choose the categories of merchandises and then choose the merchandises.