上海交通大学python程序设计课程.pptxVIP

  • 141
  • 0
  • 约2.29千字
  • 约 68页
  • 2020-02-24 发布于上海
  • 举报
面向对象思想和编程;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;类的定义;实例变量(1);实例变量(2);21;实例创建(1);实例创建(2);例:实例创建(1);例:实例创建(2);方法调用;方法调用图示;编程案例:模拟炮弹飞行(1);编程案例:模拟炮弹飞行(2);编程案例:模拟炮弹飞行(3);from math import pi, sin, cos def main(): angle = input(Enter the launch angle: ) vel = input(Enter the initial velocity: ) h0 = input(Enter the initial height : ) time = input(Enter the time interval : ) radians = (angle * pi)/180.0 xpos = 0 ypos = h0 xvel = vel * cos(radians) yvel = vel * sin(radians) while ypos = 0: xpos = xpos + time * xvel yvel1 = yvel - 9.8 * time

文档评论(0)

1亿VIP精品文档

相关文档