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

L. MacKenzie
  • 493
  • 4
  • 14
  • I would suggest using a while loop instead of restarting your script. [Like this](https://stackoverflow.com/questions/20337489/python-how-to-keep-repeating-a-program-until-a-specific-input-is-obtained) – MisterMystery Oct 17 '17 at 18:00

1 Answers1

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
SatanDmytro
  • 537
  • 2
  • 7