Episode Notes
On this episode of the podcast, Michael discusses the differences. between interpreted and Compiled programming languages.
Challenge results from episode 2.
Swift
// Ask for the user's name and age
print("What is your name?")
let name = readLine() ?? ""
print("What is your age?")
let ageString = readLine() ?? ""
let age = Int(ageString) ?? 0
// Print a statement based on the user's age
if age < 0 {
print("Invalid age!")
} else {
print("(name), you are a minor.")
JavaScript
// Ask for the user's name and age
let name = prompt("What is your name?");
let ageString = prompt("What is your age?");
let age = parseInt(ageString);
// Print a statement based on the user's age
if (age < 0) {
console.log("Invalid age!");
} else if (age < 18) {
console.log(name + ", you are a minor."); }
else {
console.log(name + ", you are an adult.");
Python
Number Sign Ask for the user's name and age
name = input("What is your name? ")
ageString = input("What is your age? ")
Print a statement based on the user's age
print("Invalid age!")
elif age < 18:
print(name + ", you are a minor.")
else:
print(name + ", you are an adult.")
Machine Transcript
Programmatic 3 Interpreted And Compiled Languages 3:11:23 10 43 Am
Edit TranscriptRemove HighlightingAdd Audio FileExport...?
[0:09] All right, hi everyone. Welcome to another episode of the Programmatic Podcast.
My name is Michael Dois, and while we're on episode three of the show, really exciting stuff, and I'm glad that we're back.
This is really a great show, and we're going to do even more great episodes.
I have a treat for you guys today, so I'm very excited to be here.
We wanna start off today with our typical challenge results.
[0:36] So last time I asked you guys to create a program that would let you get input and use a conditional based on that input.
So like if you're you know you ask for an age or whatever you do something based on that variable.
So as we did last time we're going to have 11 labs go ahead and read the different languages.
So first up we have the Swift.
Slash, slash, ask for the user's name and age.
[1:11] Print left parentheses, double quote, what is your name? Question mark, double quote, right parentheses.
Let name equals read line left parentheses, right parentheses, question mark, question mark, double quote, double quote.
Print, left parentheses, double quote, what is your age? Question mark, double quote, right parentheses.
Let age string equals read line left parenthesis. Question mark, question mark, double quote, double quote, let age equals int, left parenthesis, age string, right parenthesis, question mark, question mark, zero, slash slash, print a statement based on the user's age.
If age is less than zero, left curly brace, print left parenthesis, double quote, invalid age.
Exclamation mark, double quote, right parenthesis. Right curly brace, else if age is less than 18, left curly brace, print left parenthesis, Double quote backslash left parenthesis name, right parenthesis, comma.
You are a minor.
Double quote right parenthesis right curly brace. Else left curly brace print left parenthesis double quote backslash left parenthesis name, comma name. You are an adult.
[2:16] Double-quote right parenthesis write curly brace javascript slash slash ask for the user's name and age let name equals prompt left parenthesis double quote what is your name double quote right parenthesis semicolon let age string equals prompt left parenthesis double quote what is your age double quote right parenthesis semicolon let age equals parsant left parenthesis age string right parenthesis semi colon slash slash print a statement based on the user's age if left parentheses age is less than zero right parenthesis left curly brace console dot log left parenthesis double quote invalid age double quote right parenthesis semi colon right curly brace else if left parenthesis age is less than 18 right parenthesis left curly brace console dot log left parenthesis name plus double quote comma, you are a minor, double quote right parenthesis, semi colon, right curly brace.
Else, left curly brace, console dot log, left parenthesis name plus double quote comma, You are an adult. Double quote write parenthesis. Semicolon, write curly brace.
[3:27] And Python. Hash. Ask for the user's name and age.
Name equals input, left parenthesis, double quote, what is your name, double quote, right parenthesis.
Age string equals input, left parenthesis, double quote, what is your age, double quote, right parenthesis.
Age equals int left parenthesis, age string, right parenthesis.
Hash print a statement based on the user's age. If age is less than zero colon, indent level one, print left parenthesis, double quote, invalid age, double quote, right parenthesis.
Elif age is less than 18 colon. Indent level one, print left parenthesis, name plus double quote, comma, you are a minor, double quote, right parenthesis.
Else, indent level one, print left parenthesis, name plus double quote, comma, you are an adult, double quote, right parenthesis.
All right, thanks 11 Labs for providing these voices to us to use for this.
It's been very interesting working with the 11 Labs website as they require, it requires you to use punctuation to, you know, spell out the punctuation to get everything written correctly.
[4:44] So that's kind of crazy just spelling every parentheses, left parentheses, all of that out.
And something that Taylor told me to try to do is to take all of the code in ChatGPT and tell it to spell out all of the punctuation in the code.
[5:02] And I thought that was a brilliant idea. So I wanted to mention that here.
So whenever I put the results on episode four's video or audio and for, well, I guess for the podcast, the audio, you guys will be the first to see how that works.
So I'm pretty excited to see if that works well or not. So I'll report back then.
OK, so we have a great topic today that I thought was very interesting, and I wanted to talk to you all about today.
And that is the difference between an interpreted programming language and a compiled programming language.
And believe it or not, there are some of those that are mixed.
And so it's quite interesting.
[5:50] So what is an interpreted language? An interpreted language is a programming language that is similar to JavaScript, Python, PHP, Perl, several of these others that will, that execute code line by line.
They interpret what is written from the top down in each file.
So the code is interpreted at runtime.
So some people think that a lot of these languages are slower because all of the code is read from the top down and it has to go line by line and through the conditions to process all of that information.
This is true. I mean, it really can slow things down depending on how many lines of code you have.
Whereas compiled code is all converted to machine code binary and it's all, you know, the code is presented in machine code at once.
So the computer can read through the code much faster and process the information quicker than what it could with interpreted languages.
[7:11] For example, if I'm writing a program in Python, I can use the Python interpreter to see what I'm doing before I do it.
[7:23] So I can use the Python interpreter to write several lines of code before I even put it in my program.
And when you run your code, you're even running it with the Python interpreter.
So it's quite interesting to think about the differences between these languages, whereas like Swift, you know, I'm compiling that into machine code.
But Swift also can be ran...