|
0.找个在线编译器本例为 https://c.runoob.com/compile/66
1.复制下述代码:
--MIT licence, lua ver 5.3.5
function displacement(b, s) return (b/2)^2 * math.pi * s end
function cut(o, d) return o-o%10^-d end
bore, stroke = 82, 53.6 --长度 mm
print("缸径:", bore, "mm, 压缩行程:", stroke, "mm; 引擎排量:", cut(displacement(bore, stroke)/1000, 2), "cc")
2.把变量 bore, stroke = 82, 53.6 分别改称你车的机子参数, 贴到线编译器里
3.点击运行之后看结果
NC300 实际排量 283.06 cc 差这么多好意思叫三百呢
python 在线编译器 https://c.runoob.com/compile/9
与代码:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# MIT licence
import math
def displacement(b, s) : return (b/2)**2 * math.pi * s
bore, stroke = 82, 53.6 # mm
print(
"bore:", bore, "mm, stroke:", stroke, "mm; engine displacement:",
round(displacement(bore, stroke)/1000, 2), "cc"
)
想把树莓派装车号码牌后面但一直懒癌末期, 现 qpython 装手机上瞎对付呢
的确对飞了多高多远, 爬了多大的坡有兴趣研究但时间少啊看来得等退休再搞啦
|
|