Python
program to perform addition of two numbers and display average
# variable declared and values assigned to variable
with = assignment operator
number1=20
number2=30 #
variable
Addition=number1+number2
average=(number1+number2)/2
print("The addition of two number1 and number2
is:",Addition)
print("The average of two numbers
is:",average)
Output:
The addition of two number1 and
number2 is: 50
The average of two numbers is: 25.0
In
above program number1 and number2 are two variables used to store integer values.
= is assignment operator used to store values
in number1 and number2 variables.
Addition
variable is declared to perform addition of two variables.
Average
variable is used to find average of these two variables.
Print() function in python is used to display
result or message on screen. The result stored in a variable is displayed with
print() function or just typing the name of variable which hold the result and then click run.
#
character in Python is used to write comment lines. For multiline comment lines
just use # character in front of your text.
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏