0

So, I've been having troubles with restarting a script within itself. I'm making a simple program and I want to have a choice for example:

print ('would you like to make another calculation')

choice3 = input(' Choose: [Y], [N]')

if choice3.lower() == 'y':
    print ('OK!')
    time.sleep(3)

and I want to have it restart right there. If anyone could help me out, thanks... I really appreciate it

1
  • I would suggest using a while loop instead of restarting your script. Like this Commented Oct 17, 2017 at 18:00

1 Answer 1

2

You can do this using loop:

while True:
    print ('would you like to make another calculation')
    choice3 = input(' Choose: [Y], [N]')
    if choice3.lower() == 'y':
        print ('OK!')
        time.sleep(3)
    else:
        break
Sign up to request clarification or add additional context in comments.

1 Comment

That worked perfectly. Thanks, I really appreciate it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.