From the course: Learning Python
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Conditional decisions - Python Tutorial
From the course: Learning Python
Conditional decisions
- [Instructor] One of the most common operations that almost any program has to perform is making decisions. Your programs will often need to compare different values to each other and execute code based upon the logical outcome, and that's where conditional logic comes into play. So here in the editor, I'm going to open up the conditionals_start file. And if you're using Colab, you can just go ahead and copy and paste the starting point code into a notebook cell. And you've probably noticed I've declared two variables on the same line. I didn't show this in the variables video, but you can actually declare multiple variables on the same line, like this. So I'm going to copy this and paste it into Colab. And if you need to make a new code cell, just go ahead and click on + Code. And we'll come back to that in just a moment. All right, in Python, conditional decisions are handled using the if statement. And I've got my two variables, and they're starting off with the values 10 and 100.…