top of page

If-Else

You're currently learning a lecture from the course: 

... 

Prerequisite Terminologies

In order to have thorough understanding of the main topic, you should have the basic concept of the following terms:

Duration: 

Transcription

By:

Hamsa Ehsan

Introduction:

‘If-else' statements in Python are the most important flow controls. Hence, we can control the flow of our program using if-else statements or various loops. The syntax of these statements is almost same in all of the programing languages. If-else statements are very useful in Bioinformatics as well.


Steps:

  • Open visual studio code and save your file.

  • First, declare a variable.

  • You can control the flow of this variable's expression by using if-else statement, the simple syntax of these statements is:

       If condition:

           Statement

       else:

           Statement

  • 'if statement’ will execute if the condition is true.

  • ‘Else statement’ will execute if the “if condition” is false.

  • You can add as much conditions as you want before else statement by using:

       elif condition:

           Statement


Summary:

In this video, we had a look at the ‘if-else statements’ and that they are very important for performing various tasks and how helpful it is for Bioinformatician. We learnt how these statements are executed and should not be ignored.

File(s) Section

If a particular file is required for this video, and was discussed in the lecture, you can download it by clicking the button below.

Useful Data
bottom of page