I'm trying to make optional import
ing a module, but I'm not able to rewrite the code in an easier way (it works like this):
import sys
sys.path.append('\python_work\chemistry\import')
prompt = "Would you like to check if calculus worked as it should? (yes/no) "
if prompt == 'yes':
import normal_termination
elif prompt == 'no':
# pale_green + end are from a colouring module
print(pale_green + "Skipping to the next step" + end)
else:
active = True
while active:
message = input(prompt)
if message == 'yes':
active = False
import normal_termination
elif message == 'no':
active == False
print(pale_green + "Skipping to the next step" + end)
break
I tried many different things but nothing works.
What I want it to do is: Ask a simple question. If answer = yes -> import
; If answer = no -> print(message)
; If answer != yes, answer != no, repeat the user input.