IF Statements In Python
IF STATEMENTS.
If Statements is used to control the flow of program. We are able to solve complex types of program using If Statements. If Statements help to find certain Condition. If statement give output TRUE if and if only the condition is satisfy.
Simple Example of IF Statements :
from random import randint
num=randint(1,10)
guess_num=eval(input("Enter your guess "))
if guess_num == num: print("You got right number")
print("The right number is:", num)
>> Output >> Enter your guess >> 6
>> You got right number
>> The right number is: 6.
Simple Example of IF Statements :
from random import randint
num=randint(1,10)
guess_num=eval(input("Enter your guess "))
if guess_num == num:
print("The right number is:", num)
>> Output >> Enter your guess >> 6
>> You got right number
>> The right number is: 6.
Comments
Post a Comment