From the course: Intermediate Python for Non-Programmers
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
To-do list polish - Python Tutorial
From the course: Intermediate Python for Non-Programmers
To-do list polish
- [Instructor] All right, let's go ahead and work on the functionality when someone wants to add a to-do into their list. Okay, the first thing that we got to do is make sure that they've actually passed in the arguments to add something. So the first check for us is there should be at least three arguments here. The name of the file add and then whatever the name of that particular to-do is. So let's do that check first, we're going to say if and we want to get the length of whatever the arguments are. So we're going to say sys.argv, and we want to make sure that this is at least three or greater. Okay, so we're going to say greater than or equal to three. Okay, that's the first thing we got to check. Then we also want check. So we're going to put an, and here we're going to say we're going to make sure that this is more than three at least three and more. And the next thing that we're looking for is that ad is going to be the second item inside of those argvs. So we're going to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.