python而true不能让它循环

时间:2018-05-21 00:13:10

标签: python python-3.x

我还在学习python

但我遇到了一个奇怪的错误,我可以得到while true循环但是sub而true却不能

我只能回到开头,我不知道我做错了什么,((这是我编写的第三天,我已经在过去2天完成了一些在线课程))

def total(W):
print("ur total is :  ", W)

at = ""
att = ""

V = 0   
enter = ""

while enter == "":
enter = input ("choose A or T")
if enter.lower().startswith("a"):
    enter = input(" Enter An integer or 'Q' for quitting : ")
    if enter.lower() == "q":
        total(V);
    elif enter.isdigit():
        while enter.isdigit():


            att = at +"\n"+ enter
            at = att


            V = V + int(enter)

            enter = input(" Add anything else or Q for quiting : ")
            if enter.lower() == "q":
                print("items : \n-------\n  ",att)
                print ( "Total = ",V)
            elif enter.isdigit() == False:
      #   >>> i can't make it loop :S
                print (" error try again ")




# >>>      can't loop this too :S          
    else:
        print(enter ,"  is invalid!! ")
        enter = "apple"


elif enter.lower().startswith("t"):
    enter = input(" Enter An integer or 'Q' for quitting : ")

    if enter.isdigit():
        while enter.isdigit:
            V = V + int(enter)
            enter = input ("anything else or Q for quiting: ")
            if enter.lower() == "q":
                print ("total :", V)

    else:
        print(enter ,"  is invalid! ")
        enter.lower().startswith("t")



else:
    print(enter ,"  is invalid ")
    enter = ""

0 个答案:

没有答案