Welcome back to 100 Days Of Code guys In today's video we'll write our Python program I'd rather say our very own first Python program Because this Python program is going to be in which we'll write every line with understanding We'll have full understanding about our Python program And we'll write this code from scratch In upcoming videos we'll write quite mind-blowing Python programs from scratch But this is going to be our first program Let's move to the computer screen. And let's get started. [STARTING THEME] So I've opened my day #4 Repl And today we're going to write our first Python program But pal, we already had written our first python program In fact we wrote a lot of programs But this program is going to be one, which I'll write from scratch character-by-character & word-by-word So there's another feeling writing this So what you first have to do is.
. . .
You've to write "print" Now let me tell you what does 'Print' in Python means 'Print' is a function Now what is function? Function is used to perform any task 'Print' is function. And to invoke any function we use parenthesis() like this As you can see I've opened a parenthesis after writing "print" And then I can close it in this manner And whatever I'll write in between will be printed Let's suppose if I write " 7 " here So " 7 " will be printed But do you know what we'll do?
We'll write "Hello World" May be you're already familiar with "Hello World" Whenever someone write code in Python or any other programming language So the very first program that we write is "Hello World" Now look as I wrote "print(Hello World)" so a red line has appeared here Now what's this man! "invalid syntax" Now let's try to run this "Man! We started with an error" Yes!
we started with an error Because we'll rise when we'll fall So look I've written "print(Hello World) And I got an error Do you know why this occurred? In python when you use 'Print' function so you've to add a valid object "(Hello World)" is not a valid object for Python Pythons says I don't know what "(Hello World)" is Yes! If you enclose this in a Double-quote(" ") So Python programming knows that you're now talking about a 'String' And "("Hello World")" is a string Let's try to run this & we've written our first Python program And we're able to see the "Hello World" Are you all eyes?
We are able to see "hello World" Give a big round of applause and write "Congratulations" in comments for you and for me This is the first program we wrote character-by-character Great! So far so good If I write "Print" here and then if I write "5" and then if I run this So at first I'll got "Hello World" And then I'll got "5" We used Python in terminal And we learned that when we write "python3" in terminal And then if. .
. . .
. I write "print("Hello World")" So I've to write manually line-by-line I've to type everything here manually one-by-one Can you see I first typed "Hello World" And then I typed "print("5")" So will I type everything one-by-one? No!
There's no need for me to write them one-by-one I can create a script. That's why I created this script "main. py" Script means our code will be executed line-by-line If I've written "Hello World" first so it'll be printed first And then "print("5")" will be executed And as I'll write "print("Bye")" here And then if I run it So I'll first get "Hello World" then "5" and then "Bye" So this script is executing code line by line Now how "print" has been written, we don't need to go to its implementation Now if you want to know for what else "print" is used So look Replit is displaying.
. . As I hovered my cursor here so it is asking for the values It'll be an object You can give multiple values by adding comma(,) As I wrote "Hello World , 7" so "Hello World 7" has been printed" And then the rest of the two statements executed And line-by-line our script will be executed Can we only perform 'Print' function with the help of Python Programming Language?
No man! That's not the only thing. We can do a lot of other stuff And this is the quality of this course that it'll tell what will we do Because we are just starting and this is our first Python Program We are just understanding things What are 'Scripts' And when we execute a command line-by-line And when we give any command to Python interpreter in Repl This is called 'Repl' When we write "python3" here "Python3" this is called Repl Read, Evaluate, Print, Loop When I'll command it "8+9" so "17" will appear But then I've to write something again and I'll get it's output I'll get the output as I keep on writing commands Ideally we don't wanna do this Ideally we want Python to process the sequence of instruction We want to tell Python to do anything we want Execute this one first and then this one and then this one And let's suppose I bought Okra for ₹10/Kg Or I bought 5Kg Or let's suppose I bought it ₹17/Kg And I bought 13Kg So I'll tell Python that I bought Okra for ₹17/Kg And I bought 13Kg So what's the total?
And it'll tell you So you can do operations like this in print function For multiplication you've to use star(*) don't use (X) even by mistake And for divide you've to use slash(/) And (+) (-) these are simple give them a try But look the total is ₹221 and I've to give it to the seller So Python can also do computations like this In the upcoming videos we're going to learn some more things Just be with me in this course And I want to tell you for whom this course is not suitable If you guys can't stay consistent daily Or you want to do things in a shortcut manner So this course is not for you Because this course requires consistency It demands you to practice things as you keep on watching the videos And invest your precious time to complete this 100 Days Of Code challenge You've to reach the 100th day Mark your attendance in the comment section with "I'm present".