注意:此页面搜索的是所有试题
河南理工大学-计算机科学与技术-Python语言程序设计
[程序题,5分] 阅读下面的程序,判断其是否可以正常运行,如果可以运行则写出执行结果,如果不能 运行则写出理由。 classTest: def__init__(self,value): self.__value=value @property defvalue(self): returnself.__value t=Test(3) t.value=5 print(t.value)
[程序题,5分] 写出下面代码的运行结果。 defSum(a,b=3,c=5): returnsum([a,b,c]) print(Sum(a=8,c=2)) print(Sum(8)) print(Sum(8,2))
[程序题,5分] 下面的代码是否能够正确运行,若不能请解释原因;若能,请分析其执行结果。 >>>x=list(range(20)) >>>foriinrange(len(x)): delx[i]
[程序题,5分] 阅读下面的代码,分析其执行结果。 defdemo(*p): returnsum(p) print(demo(1,2,3,4,5)) print(demo(1,2,3))
[程序题,5分] 编写程序,运行后用户输入4位整数作为年份,判断其是否为闰年。如果年份能被400整除,则为闰年;如果年份能被4整除但不能被100整除也为闰年。
[程序题,5分] 阅读下面的代码,解释其功能。 >>>importstring >>>x=string.ascii_letters+string.digits >>>importrandom >>>print(...join(random.sample(x,10)))
[程序题,5分] 编写函数,模拟Python内置函数sorted()。
[程序题,5分] 编写程序,在D盘根目录下创建一个文本文件test.txt,并向其中写入字符串helloworld。
[程序题,5分] 阅读下面的代码,解释其功能。 >>>x=[range(3*i,3*i+5)foriinrange(2)] >>>x=list(map(list,x)) >>>x=list(map(list,zip(*x)))
[程序题,5分] 写出下面代码的运行结果。 defSum(a,b=3,c=5): returnsum([a,b,c]) print(Sum(a=8,c=2)) print(Sum(8)) print(Sum(8,2))
[程序题,5分] 下面的代码是否能够正确运行,若不能请解释原因;若能,请分析其执行结果。 >>>x=list(range(20)) >>>foriinrange(len(x)): delx[i]
[程序题,5分] 阅读下面的代码,分析其执行结果。 defdemo(*p): returnsum(p) print(demo(1,2,3,4,5)) print(demo(1,2,3))
[程序题,5分] 编写程序,运行后用户输入4位整数作为年份,判断其是否为闰年。如果年份能被400整除,则为闰年;如果年份能被4整除但不能被100整除也为闰年。
[程序题,5分] 阅读下面的代码,解释其功能。 >>>importstring >>>x=string.ascii_letters+string.digits >>>importrandom >>>print(...join(random.sample(x,10)))
[程序题,5分] 编写函数,模拟Python内置函数sorted()。
[程序题,5分] 编写程序,在D盘根目录下创建一个文本文件test.txt,并向其中写入字符串helloworld。
[程序题,5分] 阅读下面的代码,解释其功能。 >>>x=[range(3*i,3*i+5)foriinrange(2)] >>>x=list(map(list,x)) >>>x=list(map(list,zip(*x)))