10. Write a python program to calculate Area of the triangle.
11. What is the method to delete an element from a tuples?
Answers
Answer:
11.Removing individual tuple elements is not possible. There is, of course, nothing wrong with putting together another tuple with the undesired elements discarded. To explicitly remove an entire tuple, just use the del statement.
10.Python program to find the area of a triangle
# Three sides of the triangle is a, b and c:
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.
11.
Answer:
1 Python program to find the area of a triangle
# Three sides of the triangle is a, b and c:
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.
2 Removing individual tuple elements is not possible. There is, of course, nothing wrong with putting together another tuple with the undesired elements discarded. To explicitly remove an entire tuple, just use the del statement.