Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> n = int(input("请输入一个整型值N:"))
请输入一个整型值N:4
>>> n
4
>>> print(n)
4
>>> type(n)
<class 'int'>
>>>
>>> for i in range(5):
print(i)
0
1
2
3
4
>>> for i in range(5):
print(i, end=' ')
0 1 2 3 4
import math
a = int(input())
b = int(input())
c = int(input())
s = (a + b + c)/2
area = math.sqrt(s * (s - a) * (s - b) * (s - c))
print("三角形边长:", a, b, c, end = ' ')
print("三角形面积:", area)
运行结果:
5
13
12
三角形边长: 5 13 12 三角形面积: 30.0