From the course: Transition from C# to Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Language constructs

Solution: Language constructs

From the course: Transition from C# to Python

Start my 1-month free trial

Solution: Language constructs

(upbeat music) - [Instructor] Okay, let's take a look at how I solved this particular challenge. And remember, it's not important that your solution and mine be the same. What's important is that you compare yours with mine and see how they're similar and different from each other, and then learn from those differences. So remember, our challenge was to write a program that used positive and negative numbers to keep a running total amount and then exit when the quit command was typed. So the C# version used a while loop and the read line function on the console to read user input along with the TryParse function to try and convert the input to a number. All right, so the Python solution that I came up with is substantially similar. So let me open up that code. So the program starts by printing the same welcome message and instructions that we saw in the C# version and then declares a couple of variables, right? There's…

Contents