BASIC STRUCTURE OF A PYTHON PROGRAM
#addition of two number
a = 10
b = 20
c = a + b
print(c)
print(“Addition=“,c)
#check greater number between two
if a>b:
print(“The value of a is greater”)
else:
print(“The value of b is greater”)
Output:-
30
Addition=30
The value of b is greater
Elements of the Program
Comment – The statement which is starting with # symbol is called comment line. This line is ignored by compiler.
Statement – A statement is an instruction that the python interpreter can execute.
Expression – Expression are the statement which is used for calculation in programming language. E.g. c = a + b is an expression where the addition of a and b is stored in c. Expressions are formed with operators and operands.
Block or Suite – A block or suite are a group of statements in a program like control flow statement and looping statement.
Function – The print() or input() function in python are used to send output to the console window and receive input from the console window.
Comments
Post a Comment
Students you can ask your doubts in comment section