从Python开始:跳转至开始

时间:2019-03-09 22:52:28

标签: python-3.x

我只是从Python(3.7)开始,我想制作一个操作系统,我知道我将无法从中启动,而只是一个我正在研究的项目。到目前为止,这是我的代码:

import os   
import time 
import sys  
print("Charlie OS Python Edition Desktop")
print("What App Would You Like To Open? Remember To Type The Apps Number To Find All The Apps Type 1")
AppNumber = input("Type Here: ")
if AppNumber == "1":
    print("2 = Text Editor")
    print("3 = Shutdown Charlie OS Python Edition")
    time.sleep(5.5)
if AppNumber == "2":
    print("Not Coded Yet")
    time.sleep(2.2)
if AppNumber == "3":
    print("Goodbye!")
    time.sleep(2.2)
    sys.exit    

制作精美文字3

1 个答案:

答案 0 :(得分:0)

您可以将检查用户输入的代码放在while循环中:

import os   
import time 
import sys  
print("Charlie OS Python Edition Desktop")
while True:
    print("What App Would You Like To Open? Remember To Type The Apps Number To Find All The Apps Type 1")
    AppNumber = input("Type Here: ")
    if AppNumber == "1":
        print("2 = Text Editor")
        print("3 = Shutdown Charlie OS Python Edition")
        time.sleep(5.5)
    if AppNumber == "2":
        print("Not Coded Yet")
        time.sleep(2.2)
    if AppNumber == "3":
        print("Goodbye!")
        time.sleep(2.2)
        sys.exit()