上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第五次上机_第五次上机

第五次上机题目 Problem 1 问题描述: 在l0.3.2中的projectile..py程序基础上,添加getDistance(self,time)函数,计算质点在time 时间内运行的路程。 程序文件命名:1py Problem 2 问题描述:第十章课后第l7题:首先定义Regression类,然后使用Regression类,完成第 8章的Programming Exercise 13的要求。 Redo the regression problem from Chapter8(Programming Exercise 13)using a Regression class. Your new class will keep track of the various quantities that are needed to compute a line of regression(the running sums of x,y,x2,and xy).The regression class should have the following methods: init Creates a new regression object to which points can be added. addPoint Adds a point to the regression object. predict Accepts a value of x as a parameter,and returns the value of the corresponding y on the line of best fit. Note:Your class might also use some internal helper methods to do such things as compute the slope of the regression line. 程序文件命名:2py Problem 3 问题描述:Chapter1 1 Exercises 19 Create and test a Set class to represent a classical set.Your sets should support the following methods: Set(elements)Create a set(elements is the initial list of items in the set). addElement (x)Adds x to the set. deleteElement(x)Removes x from the set,if present.If x is not in the set,the set is left unchanged
第五次上机题目 Problem 1 问题描述: 在 10.3.2 中的 projectile.py 程序基础上,添加 getDistance(self,time)函数,计算质点在 time 时间内运行的路程。 程序文件命名:1.py Problem 2 问题描述:第十章课后第 17 题:首先定义 Regression 类,然后使用 Regression 类,完成第 8 章的 Programming Exercise 13 的要求。 Redo the regression problem from Chapter 8 (Programming Exercise 13) using a Regression class. Your new class will keep track of the various quantities that are needed to compute a line of regression (the running sums of x, y, x 2 , and xy). The regression class should have the following methods: __init__ Creates a new regression object to which points can be added. addPoint Adds a point to the regression object. predict Accepts a value of x as a parameter, and returns the value of the corresponding y on the line of best fit. Note: Your class might also use some internal helper methods to do such things as compute the slope of the regression line. 程序文件命名:2.py Problem 3 问题描述:Chapter 11 Exercises 19 Create and test a Set class to represent a classical set. Your sets should support the following methods: Set (elements) Create a set (elements is the initial list of items in the set). addElement (x) Adds x to the set. deleteElement(x) Removes x from the set, if present. If x is not in the set, the set is left unchanged

member (x)Returns true if x is in the set and false otherwise. intersection(set2)Returns a new set containing just those elements that are common to this set and set2. union(set2)Returns a new set containing all of elements that are in this set,set2,or both display()Show all the elements in the set Use the following program to test your new class. def main(): 1st1=[1,2,3,4,5,6] 1st2=[5,6,7,8,9] s1=Set(Ist1) s2=Set(Ist2) s1.addElement(8) s2.deleteElement(10) s3=s1.intersection(s2) s4=s1.union(s2) s3.display() s4.display() 程序文件命名:3py
member (x) Returns true if x is in the set and false otherwise. intersection(set2) Returns a new set containing just those elements that are common to this set and set2. union (set2) Returns a new set containing all of elements that are in this set, set2, or both. display() Show all the elements in the set Use the following program to test your new class. def main(): lst1=[1,2,3,4,5,6] lst2=[5,6,7,8,9] s1=Set(lst1) s2=Set(lst2) s1.addElement(8) s2. deleteElement(10) s3=s1. intersection(s2) s4=s1.union(s2) s3.display() s4.display() 程序文件命名:3.py
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第三次上机_Python第三次上机解析-update.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第三次上机_python第三次上机.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第一次上机_第一次上机内容_10.18.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第一次上机_第一次上机内容_10.18.doc
- 上海交通大学:《科学计算》课程教学资源(英文讲义)Lecture Note 4:Numerical differentiation and integration.pdf
- 上海交通大学:《科学计算》课程教学资源(英文讲义)Lecture Note 3:Polynomial Interpolation.pdf
- 上海交通大学:《科学计算》课程教学资源(英文讲义)Lecture Note 2:Solution of nonlinear equations.pdf
- 上海交通大学:《科学计算》课程教学资源(英文讲义)Lecture Note 1:Introduction, calculus review and computer representation of numbers.pdf
- 上海交通大学:《计算机辅助设计》教学资源_Product Visualization.doc
- 上海交通大学:《编译原理》教学资源_教学资料_第四周讲义_Syntax-Directed Translation.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第六周讲义_Run-Time Environments.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第六周讲义_Heap Management.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第六周讲义_Intermediate Code Generation.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第八周讲义_Machine-Independent Optimizations Ⅲ.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第八周讲义_Machine-Independent Optimizations Ⅱ.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第八周讲义_Machine-Independent Optimizations Ⅰ.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第五周讲义_Type Checking.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第二周讲义_lex.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第二周讲义_Syntax Analyzer.pdf
- 上海交通大学:《编译原理》教学资源_教学资料_第二周讲义_Lexical Analyzer.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源(上机课)第四次上机_Python第四次上机题目.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源_作业_第一次作业内容要求.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源_作业_第一次作业内容要求.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源_参考教材_HowToThink-Python.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源_参考教材_参考教材-2002版-PythonProgrammingBook.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源_参考教材_参考教材-python-programming.pdf
- 上海交通大学:《程序设计思想与方法》课程教学资源_往年试卷_CT2012-A卷-final 2_参考答案.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源_往年试卷_CT2012-A卷-final.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源_期末大作业要求.doc
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter01 课程简介、计算机与程序.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter02 程序基本构件.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter03 数值计算.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter04 字符串计算.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)Chapter05 面向对象与图形编程.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter06 函数.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter07 控制结构(条件语句).ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter08 控制结构(循环语句).ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)Chapter10 类的定义.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter11 数据集合体.ppt
- 上海交通大学:《程序设计思想与方法》课程教学资源(PPT课件讲稿)chapter9 模拟与设计.ppt