擅长:python、mysql、java
<p>像这样</p>
<pre><code>import math
#taking input from user
a = float(input('Enter first side of triangle: '))
b = float(input('Enter second side of triangle: '))
alpha = float(input('Enter angle between a and b: '))
#finding third side of triangle
c = math.sqrt((math.pow(a, 2)+math.pow(b, 2)) - 2*a*b*(math.cos(alpha)))
print('third side of triangle is: ', c)
#calculate perimeter
s = ((a+b+c)/2)
print('perimeter of triangle is: ', s)
#calculate area
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
print('Area of triangle is: ', area)
</code></pre>