- [Instructor] One of the fairly common scenarios…you'll run into in programming is making decisions.…Your program needs to compare values…and execute code based upon some logical outcome.…And that's where conditional logic comes into play.…In Python, conditionals are handled by the "if" statement…and that's what we're going to look at now.…So in your editor, let's open up…the conditionals_start.py.…And you can see here in the main function…of this example,…I've got two variables,…x and y, and they are ten and 100 to start with.…
Let's add our first conditional;…alright, if x is less than y…st equals x is less than y.…And then down here,…I'll write print st.…Alright, this code is comparing x to y,…and if x is less than y,…then the value of the st variable will be the strain,…x is less than y,…then we print the result.…So let's go ahead and run this.…
And you can see,…sure enough, the program prints x is less than y.…So let's see what happens if I change the value of x…to be 1000.…I'll save it, and I'll run it again.…
- Installing Python
- Choosing an editor or IDE
- Working with variables and expressions
- Writing loops
- Using the date, time, and datetime classes
- Reading and writing files
- Fetching internet data
- Parsing and processing HTML
Skill Level Beginner
1. Getting Started
2. Python Basics
3. Working with Dates and Time
4. Working with Files
5. Working with Web Data
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.