Control Flow Tools In this session we will see about control flow tools of python. 1) if Statement:- In the programming language if statement is important statement. Now we see how to write if statement in the python program. For Example:- >>> x = int(input("Please Enter an integer")) Please Enter an integer 50 >>> if x<0: x=0 print("Negative change to zero") elif x==0: print("Zero") elif x==1: print("One") else: print("More") More >>> Here is the program of if statement. You can add one or more elif part in the program. else part is the optional. In the program we take the value of x is 50. In the if statement we write x<0 condition which is false because 50 is not less than 0 so it will go to the next part of the code which is first elif part, here we give condition x==0 this condition is also false so it will go to the second elif part which is x==1 this condition is also f...

Comments
Post a Comment