Question 001-1: Please enter a three integer a,b,c to determine whether you can make them into a triangle of three side lengths. Output Yes and area if possible, otherwise the output no
A = float (input ())
b = float (input ())
c = Float (input ())
If a > 0 and b > 0 and C > 0: #判断边长是否为正
if (A + B > C) and (A + C > B) and (B + C > a): #判断是否可以为三角形
p = (A + B + C)/2.0
S = (p* (p-a) * (p-b) * (p-c)) **0.5 #面积, Helen Formula
Print ("YES, side length: a = {},b = {},c = {}, area: {}". Format (a,b,c,s))
Else
Print ("NO")
Else
Print ("NO")
Question 001-2: The number of reversible primes is to reverse the order of the number of numbers of a prime, and still be prime, please program and output a reversible prime within 200
Note: 1 is not a prime or a composite.
Def getrenums (n):
if ((n//100 ==0) & (N//10 ==0)):
&N Bsp NUM1 = n
NUM2 = n
ELSE:
&NBS P if ((n//100 ==0) & (N//10!=0):
 NUM1 = n
 NUM2 = n%10 * + N//10
&NBS P else:
NUM1 = n
&NBS P NUM2 = n%100%10 * +n//10%10*10 +n//100
return num1,num2
For n in range (2,200,1):
num1,num2 = Getrenums (n)
DEVN1 = 0
DEVN2 = 0
For I in Range (2,num1,1):
if (num1%i ==0):
DEVN1 = devn1+1
For I in Range (2,num2,1):
if (num2%i ==0):
DEVN2 = devn2+1
if ((devn1==0) & (devn2==0)):
Print (n)
"Daily Code question 001"-Python Basics Review