Program 1
1. Write a Python program to find sum and average of two numbers
Program 1:
In this program, you will learn to add two numbers and display it using print() function.
To understand this progam, you should have the knowledge of the following Python
programming topics:
Python Basic Input and Output
Python Data Types
Python Operators
# Python program to find average of two numbers
# first number
num1 = 10
num2 = 20
sum=num1+num2
print('sum of numbers = %d' %sum)
avg = (num1+num2)/2
print('The average of numbers = %0.2f' %avg)
OUTPUT
sum of numbers = 30
The average of numbers = 15.00
Comments
Post a Comment