if statements quite often in programs we only want to do something provided something else is true python' if statement is what we need simple example let' try guess- -number program the computer picks random numberthe player tries to guessand the program tells them if they are correct to see if the player' guess is correctwe need something newcalled an if statement from random import randint num randint( , guess eval(input'enter your guess')if guess==numprint'you got it'the syntax of the if statement is lot like the for statement in that there is colon at the end of the if condition and the following line or lines are indented the lines that are indented will be executed only if the condition is true once the indentation is done withthe if block is concluded the guess- -number game worksbut it is pretty simple if the player guesses wrongnothing happens we can add to the if statement as followsif guess==numprint'you got it'elseprint'sorry the number is 'numwe have added an else statementwhich is like an "otherwise