高手求教~~~关于python编程的题目:
看没人理你。。怪可怜的,,,就帮你做好了。。。看代码
#! /usr/bin/env python
#coding=utf-8
Created on 2011-1-29
@author: qihigh
class baiduAns:
__fruitLeft = 20
__buyDay = 5
__x = None
__y = None
def __init__(self, x, y):
self.__x = x
self.__y = y
def daydayAfter(self,days):
for i in range(1, days 1):
print("self.daySell(" str(i) ")")
# exec("self.daySell(" str(i) ")")
self.daySell(i)
return self.__fruitLeft
def daySell(self,day):
if(self.isSelling(day)):
left = self.__fruitLeft - self.__x
if(left lt 0):
self.__fruitLeft = 0
self.__fruitLeft = left
def YArray(self):
self.__fruitLeft = 20
def isSelling(self,day):
卖货周期 5 y
if(day%(5 self.__y) == 0):
货刚到了 不卖
self.YArray()
return False
elif(day%(5 self.__y) lt= 5 and self.__fruitLeft != 0):
卖
return True
else:
有货也不卖
return False
if __name__ == __main__:
‘’‘ 传入参数顺序 x 、y ’‘’
ans = baiduAns(5,1)
h math.sqrt(r*r h*h)
a=r*h/2
s=pi*r*(r math.sqrt(r*r ltstdio.hgt
void main()
{
char a
int z=0,k=0,s=0,q=0
printf("请输入一行字符: ")
while((a=getchar())!=
)
{
if(agt=aampampalt=z||agt=Aampampalt=Z)
z
else if(agt=0ampampalt=9)
s
else if(a== )
k
else
q
}
printf("字母:%d
数字:%d
空格:%d
其它字符:%d
",z,s,k,q)
}
关于python语言的小程序题 求指点,谢谢了!
import random
a=[]
i=random.randint(1,10)
for j in range(1,i 1):
x=random.randint(0,9)
a.append(x)
print a
k=random.randint(1,10)
b=[]
for m in range(1,k 1):
y=random.randint(0,9)
b.append(y)
print b
c=list(set(a)ampset(b))
print c
d=list(set(a)|set(b))
print d