赞
踩
- # 请在下面填入定义Book类的代码
- ########## Begin ##########
- class Book:
- ########## End ##########
- '书籍类'
- def __init__(self,name,author,data,version):
- self.name = name
- self.author = author
- self.data = data
- self.version = version
-
- def sell(self,bookName,price):
- print("%s的销售价格为%d" %(bookName,price))
-
- class People:
- # 请在下面填入声明两个变量名分别为name和country的字符串变量的代码
- ########## Begin ##########
- def __init__(self, name, country):
- self.name = name
- self.country = country
- ########## End ##########
- def introduce(self,name,country):
- self.name = name
- self.country = country
- print("%s来自%s" %(name,country))
- name = input()
- country = input()
- # 请在下面填入对类People进行实例化的代码,对象为p
- ########## Begin ##########
- p = People(name, country)
- ########## End ##########
- p.introduce(name,country)
-
-
- import fractionSumtest
- # 请在下面填入创建fractionSum的实例fs的代码
- ########## Begin ##########
- fs = fractionSumtest.fractionSum()
-
- ########## End ##########
- n = int(input())
- if n % 2 == 0:
- # 请在下面填入调用fractionSumtest类中dcall方法的代码,计算当n为偶数时计算的和
- ########## Begin ##########
- sum = fs.dcall(fs.peven,n)
- ########## End ##########
- else:
- # 请在下面填入调用fractionSumtest类中dcall方法的代码,计算当n为奇数时计算的和
- ########## Begin ##########
- sum = fs.dcall(fs.podd,n)
- ########## End ##########
- print(sum)
-
-
-
-
- class BookSell:
- static_var = 100
- def sell(self,name,author,version,price):
- print("%s的销售价格为%d" %(name,int(price)))
- # 请在下面填入函数修饰符将printStatic()方法声明为静态方法
- ########## Begin ##########
- @staticmethod
- ########## End ##########
- def printStatic():
- print(BookSell.static_var)
- # 请在下面填入函数修饰符将printVersion(cls)方法声明为类方法
- ########## Begin ##########
- @classmethod
- ########## End ##########
- def printVersion(cls):
- print(cls)
-
-
-
-
-
- # 从 DataChangetest 模块中导入 DataChange 类,并使用该类中的 eightToten(self,p) 方法,实现将输入的八进制转换成十进制输出。
- ########## Begin ##########
- import DataChangetest
- object = DataChangetest.DataChange()
- p = input()
- object.eightToten(p)
-
-
-
-
- ########## End ##########
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。