1

So I require to run a certain set of functions as given in the if statement and I want this code to keep on asking the user to enter the required conditions as given below until it enters 1(or 0) and the loop breaks.

d = 0
id d==0:
    
while (d!=1):

text = input("Enter: ").lower()

if text=='t':
    function1()
elif text =='i':
    function2()
else :
    print("Enter a valid input")
    
d=input("want to run again enter 0 for yes and 1 for no" )          


enter code here

1 Answers1

0
while True:
    a= input("want to run again enter 0 for yes and 1 for no" )
    if a=='0':
        text = input("Enter: ").lower()

        if text=='t':
            function1()
        elif text =='i':
            function2()
        else :
            print("Enter a valid input")
    elif a=="1":
        break
    else:
        print("Enter either 0/1")
Umer Rana
  • 148
  • 6
JaniniRami
  • 493
  • 3
  • 11