The document discusses different types of if statements in Python including simple if, if-else, and nested if-else. It provides code examples to find the biggest of two values using simple if and the biggest of three values using nested if-else statements. The final example uses an if statement to check the type of a variable and convert it to a string if it is an integer.
The document discusses different types of if statements in Python including simple if, if-else, and nested if-else. It provides code examples to find the biggest of two values using simple if and the biggest of three values using nested if-else statements. The final example uses an if statement to check the type of a variable and convert it to a string if it is an integer.
The document discusses different types of if statements in Python including simple if, if-else, and nested if-else. It provides code examples to find the biggest of two values using simple if and the biggest of three values using nested if-else statements. The final example uses an if statement to check the type of a variable and convert it to a string if it is an integer.
1)Simple IF(condition) 2)IF-Else 3)Nested IF 4)If-Elif
#Find Biggest among two values using simple if
a=int(input('enter the value of a ')) # takes the input of a
b=int(input('enter the value of b')) #takes the input of b
if(a>b): # checks for the condition (true or false)
print('the biggest number is ',a) #prints if the condition is true if(b>a): #checks condition print('the biggest number is', b) # print value 6 is bigger #Find Biggest among three values using if-else a=int(input('enter the value of a '))# takes the input of a b=int(input('enter the value of b '))# takes the input of b c=int(input('enter the value of c '))#takes the input of c if(a>b): #checks if a is bigger than b if(a>c): # checks if a is also bigger than c print('the bigger value is ', a) else: #block to exceute for a<c print('the bigger value is ', c) else: #block to check for b is bigger if(b>c): # checks if b is bigger than c print('the bigger value is ', b) else: # block for c is bigger than b print('the bigger value is ', c) 'the programming code contains nested if statements to check amongst three values #convert integer to string if the input is integer