0% found this document useful (0 votes)
15 views2 pages

Python Programs with Outputs Guide

The document contains practical Python programs demonstrating basic calculations, including the sum of two integers, area of a circle, area of a triangle, and percentage calculation. Each program includes user input prompts and sample outputs for clarity. The programs utilize basic arithmetic operations and the math library for calculations.

Uploaded by

arnavb0902
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Python Programs with Outputs Guide

The document contains practical Python programs demonstrating basic calculations, including the sum of two integers, area of a circle, area of a triangle, and percentage calculation. Each program includes user input prompts and sample outputs for clarity. The programs utilize basic arithmetic operations and the math library for calculations.

Uploaded by

arnavb0902
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Practical Programs with Outputs

Program 1: Sum of Two Integers

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))
print("Sum:", a + b)
Sample Output:
Enter first number: 5
Enter second number: 7
Sum: 12

Program 2: Area of a Circle

import math
radius = float(input("Enter the radius of the circle: "))
area = [Link] * radius ** 2
print("Area of the circle:", area)
Sample Output:
Enter the radius of the circle: 3
Area of the circle: 28.274333882308138

Program 3: Area of a Triangle

base = float(input("Enter base of the triangle: "))


height = float(input("Enter height of the triangle: "))
area = 0.5 * base * height
print("Area of the triangle:", area)
Sample Output:
Enter base of the triangle: 10
Enter height of the triangle: 5
Area of the triangle: 25.0

Program 4: Percentage Calculation

marks1 = float(input("Enter marks in subject 1: "))


marks2 = float(input("Enter marks in subject 2: "))
marks3 = float(input("Enter marks in subject 3: "))
percentage = (marks1 + marks2 + marks3) / 3
print("Percentage marks:", percentage)
Sample Output:
Enter marks in subject 1: 85
Enter marks in subject 2: 90
Enter marks in subject 3: 80
Percentage marks: 85.0

You might also like