I am making an MS-DOS operating system in Python, and I want the user to select an application to run.
print("""
[1] Open notepad
[2] Open file explorer
[3] Configure BIOS
[4] Exit OS safely
""")
select = input("[?]: ")
if select == '1':
execfile('edit.py')
if select == '2':
execfile('file.py')
But edit.py
runs first.
I tried assigning select to 0 at the start of the program, expecting select to not be anything (hence, no app runs), but it didn't work.
select = '0'
...
print("""
[1] Open notepad
[2] Open file explorer
[3] Configure BIOS
[4] Exit OS safely
""")
select = input("[?]: ")
if select == '1':
os.startfile('edit.py')
if select == '2':
os.startfile('file.py')