main.py: menu a ciclo fino a scelta 0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c477c5c765
commit
600b4f6dfa
1 file changed
+13
-12
@@ -13,20 +13,21 @@ MENU = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("\n=== Analisi Termica Forno ===\n")
|
while True:
|
||||||
for i, (label, _) in enumerate(MENU, 1):
|
print("\n=== Analisi Termica Forno ===\n")
|
||||||
print(f" {i}. {label}")
|
for i, (label, _) in enumerate(MENU, 1):
|
||||||
print(" 0. Esci\n")
|
print(f" {i}. {label}")
|
||||||
|
print(" 0. Esci\n")
|
||||||
|
|
||||||
scelta = input("Scegli: ").strip()
|
scelta = input("Scegli: ").strip()
|
||||||
if scelta == "0":
|
if scelta == "0":
|
||||||
return
|
break
|
||||||
if not scelta.isdigit() or not (1 <= int(scelta) <= len(MENU)):
|
if not scelta.isdigit() or not (1 <= int(scelta) <= len(MENU)):
|
||||||
print("Scelta non valida.")
|
print("Scelta non valida.")
|
||||||
return
|
continue
|
||||||
|
|
||||||
_, script = MENU[int(scelta) - 1]
|
_, script = MENU[int(scelta) - 1]
|
||||||
subprocess.run([sys.executable, str(script)])
|
subprocess.run([sys.executable, str(script)])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in new issue
Block a user