Conditional Statements in Python are used to decide the flow of execution of a program or code in Python. It’s like telling your program, “Hey, do this particular thing if it meets this condition, or if it doesn’t”. In Python, conditional statements are handled with “IF”. In this article, I am going to walk you through the different IF statements in Python, using a practical approach.

Here’s what I mean; I am not just going to give long definitions of the different types of IF statements in Python. We will see how they all work by building an online grading system for test scores with Python. It is important to note that IF Statements in Python works together with Python’s logical operators: AND, OR.

Let’s get right to it. Remember, we are going to be learning these IF statements while building an online grading system for students’ test scores.

The first thing to do is to launch your IDE. I am using the Jupyter notebook and I really recommend it. Jupyter notebook is something you get automatically when you download anaconda. Now, to writing code.

testscore = input(“Please input your testscore:”)
testscoreint = int(testscore)
The above code is to present an interactive environment on the front-end so that the user/student can enter his/her score. Running the code above will return the image below:

https://cndro.com/blog/if-statements-in-python/

##python ##programming ##coding #loops

IF Statements in Python - Cndro
1.30 GEEK