The basic of python programming
Hello! Today I am going to talk about the basic of python programming.
So, let's start,
Python programming is a very easy programming. So, at first make a hello world program,
If we want computer will write hello world on the result then we have to write a special code or program or syntax.
Here is a popular syntax or code to print a word i.e. "print"
So, the code is, print("Hello World")
Then the result is, Hello world
Here you can see that we have to maintain some rules viz. "", () etc.
The rules are mandatory to write a perfect program.
If we write print Hello World
Then the computer will show "SyntaxError: Missing parentheses in call to 'print'. Did you mean print(Hello world)?"
So, we have to maintain some rules to write a perfect python program.
Another example:
(i) print(Hello World)
Then the result is "SyntaxError: invalid syntax"
(ii) print('Hello world')
Then the result is Hello world.
Here we have written one quotation instead of double quotation. But the program is correct.
So, If we want to print a sentence or a letter or a word we have to to follow the rules, which are given below.
(i) We have to put two parantheses after the word"print"
(ii) In the parantheses we have to put quotation or double quotation.
Now, write a sum ,
print(2+3) It is a right syntax.
The computer will show 5 on the result pad.
(i) print(2*3) the result is 6
(ii) print(10+10) the result is 20
(iii) print(10/2) the result is 5.0
(iv) print(20-16) the result is 4.0
So, it is working and very easy .
My suggestion is python is best programming language for programming and for A.I programming.
0 Comments