计算机科学与编程导论小习题-MIT
2015-04-12 15:33
253 查看
第七课:数组以及可变性,字典,伪码,对于代码运行效率的简介
关于求解三角形斜边长的python代码:
关于求解三角形斜边长的python代码:
import math inputok=False while not inputok: base=input("enter base:") if type(base)==type(1.0):inputok=True else:print("error.base must be a floating point number") inputok=False while not inputok: height=input("enter height:") if type(height)==type(1.0):inputok=True else:print("error.height must be a floating point number") hyp=math.sqrt(base*base+height*height) print("base: "+str(base)+",height: "+str(height)+",hyp: "+str(hyp))
相关文章推荐
- mit 计算机科学及编程导论(12)
- MIT公开课---计算机科学及编程导论
- mit 计算机科学及编程导论(13)
- mit 计算机科学及编程导论(14,15,16)
- mit 计算机科学及编程导论(9)
- mit 计算机科学及编程导论(17,18,19)
- mit 计算机科学及编程导论(1)
- mit 计算机科学及编程导论(10)
- mit 计算机科学及编程导论(2)
- mit 计算机科学及编程导论(11)
- 麻省理工学院公开课:计算机科学及编程导论习题2
- mit 计算机科学及编程导论(1)
- mit 计算机科学及编程导论(6)
- mit 计算机科学及编程导论(7)
- MIT 6.00.1x 计算机科学和Python编程导论 Set 2
- 《编程导论(Java)•0.1 编程与计算机科学》
- 计算机科学与Python编程导论_MIT 学习笔记(七)
- MIT公开课:计算机科学及编程导论 Python 笔记5 浮点数,逐次逼近法和二分法
- 学习日记-MIT[计算机科学与编程导论]-5
- MIT6.00.1X 计算机科学和PYTHON编程导论 第一周