Command Line Interface (CLI)
00:00 Project Platform Comparison. In this section, you’re going to see the coding of a simple application which just takes two numbers, adds them together, and then reports the result.
00:10 It’s going to be coded across the three platforms we’re looking at here, so you’ll see it coded for the command line, a desktop GUI, and for the web. Let’s take a look at the application being programmed for the command line. Here, you’re going to see the application programmed for the command-line interface.
00:26
This is a really simple program and exactly the kind of thing you would have done early on in your Python career. Starting off with a simple heading, and then inputting a
and casting it to an integer.
00:42
b
is input in the same way as a
, they’re added together, and finally, the result is reported to the user.
00:54 So, this is a very simple piece of code and there is no error checking in it. Now, the point of this demonstration isn’t to produce a perfectly robust application, but to demonstrate the difference in coding which is needed to get up and running on each platform, so that’s why there’s no error and type checking on any of these.
01:12 And obviously, this would be easy to break in the real world. Now, let’s see that in action.
01:20
As you can see, a simple interface for the user and 2 + 4
does indeed equal 6
. In reviewing the code that was written, you can see that, really, it’s only four lines of functional code with an extra one added for the heading at the beginning.
01:35 This could easily be reduced to three lines, but it’s been left this way for clarity.
Chris Bailey RP Team on Sept. 3, 2020
Hi @Kevin, I agree the names of the titles were a bit misleading. I’ve adjusted the names. Thanks for pointing it out. That first line of the slides in this video, now is referring to the introduction of the command line comparison.
Become a Member to join the conversation.
Kevin Freeman on Sept. 3, 2020
@Darren, the URL for the “Command-Line Interface” video appears to be mistakenly calling up “Project Platform Comparison” by mistake. Either way, this is a great walkthrough- thanks!