I'm new here, so I apologize for the possible mistakes in my question. I'm trying to make optional importing 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':
print(pale_green + "Skipping to the next step" + end) # pale_green + end are from a colouring module
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
Aucun commentaire:
Enregistrer un commentaire