我如何获得一个If语句链接到输入

时间:2019-03-09 22:42:48

标签: python python-3.x if-statement

我正在尝试做什么 我有一个应用程序,可以告诉我打开某项内容(例如,浏览器)已经有多长时间,并且浏览器在不移动鼠标的情况下打开的剩余时间百分比以百分比表示(我可以将其转换为小数) 。该程序应该告诉我浏览器总共打开了多长时间

m = input("Type 0 for hours, or 1 for minutes")

if m == 1:
    y = input("what is the time given?")
    z = input("What is the semi-idle time?")

    y = int(y)
    z = float(z)
    x = (y / (1 - z))

    if x < 60:
        print("The total time is {} minutes".format(x))
    else:
        x = x/60
        print("The total time is {} hours".format(x))
elif m == 0:
    y = input("what is the time given?")
    z = input("What is the semi-idle time?")

    y = int(y)
    z = float(z)
    x = (y / (1 - z))

    print("The total time is {} hours".format(x))

我目前有两个代码块,if和elif语句分别工作,但是一旦运行初始输入来查找程序将完成小时还是几分钟,都不会运行。

我如何让它运行if / else语句而不结束?

0 个答案:

没有答案