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

Holiday Homework Computer Class 6

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

Holiday Homework Computer Class 6

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

Holiday homework Computer

Class - 6
Write a code in python software to make a program to find
area of a triangle.
 1st Download Python in your PC. Visit Download Python | Python.org to download python
software and click on Download Python 3.13.1
 Install software on your PC.
 Press start button and Search IDLE .
 Click on file .
 Then click on new file a new blank page will open.
 Then type this code to make this program.

a = float(input('Enter first side: '))


b = float(input('Enter second side: '))
c= float(input('Enter third side: '))
# calculate the semi-perimeter
s = (a + b + c) / 2
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)
 After writing the code press f5 key or click on run then save your file with appropriate name.
 Enter three sides of triangle using keyboard. Your program will automatically calculate the area.

Program to convert Kilometer to miles.


 Write the following code.

 # Taking kilometers input from the user


 kilometers = float(input("Enter value in kilometers: "))

 # conversion factor
 conv_fac = 0.621371

 # calculate miles
 miles = kilometers * conv_fac
 print('%0.2f kilometers is equal to %0.2f miles' %
(kilometers,miles))
 follow same steps as first code.
Learn chapter 8 and 9 and write these codes in
your note book.

You might also like