jeudi 1 février 2018

Python - Nested if statement - else go back to original if statement

I am a total noob. I am trying to loop back to the original raw_input when inside the second if statement. i want to loop the nested if statement with an option to go back to the original raw_input. hope this makes sense. Thanks

import os
os.system("clear")
start= raw_input("SUP?\n\n1: Repo\n2: Installed\n...")
if int(start)== 1:
    os.system("clear")
    while True:
        repo= raw_input("\n1: Search repo\n2: Install\n3: Back\n...")
        if int(repo)== 1:
            os.system("clear")
            search= raw_input("What are you trying to search?\n")
            os.system("apt-cache search " + search)
        if int(repo)== 2:
            os.system("clear")
            inst= raw_input("What would you like to install?\n")
            os.system("sudo apt-get install " + inst)    
        else???      
if int(start)==2:
    os.system("clear") 
    ins=raw_input("\n1: Search Installed\n2: Delete installed\n...")

Aucun commentaire:

Enregistrer un commentaire