day=int(input("enter today day="))
fday=int(input("enter num of day since today="))
c=((fday%7)+day)%7
if c==0:
print("sunday")
elif c==1:
print("monday")
elif c==2:
print("tuesday")
elif c==3:
print("wendnsday")
elif c==4:
print("thursday")
elif c==5:
print("friday")
elif c==6:
print("satueday")
二、
python复制代码
n=int(input("enter num="))
if (5%n==0)and(6%n==0):
print("is {0} dive by 5 and 6".format(n),"True")
print("is {0} dive by 5 or 6".format(n),"True")
print("is {0} dive by 5 or 6,not both:".format(n),"false")
elif (5%n==0)or(6%n==0):
print("is {0} dive by 5 and 6".format(n),"Fa1lse")
print("is {0} dive by 5 or 6".format(n),"True")
print("is {0} dive by 5 or 6,not both:".format(n),"True")
else:
pass
三、
python复制代码
for i in range(1,7):
for j in range(1,i+1):
print(j,"",end="")
print()
print()
for i in range(1,7):
for j in range(1,8-i):
print(j,"",end="")
print()
print()
for i in range(1,7):
for j in range(1,7-i):
print(" ","",end="")
for k in range(i,0,-1):
print(k,"",end="")
print()
for i in range(1,7):
for k in range(1,i):
print(" ","",end="")
for j in range(1,8-i):
print(j,"",end="")
print()
四、
python复制代码
import random
a=random.randint(0,2)#[0,2]
k=0
s=2
while k!=2 and s!=0:
b=int(input("快出拳(0,1,2)===")) #0:剪刀 1:石头 2:布
if b<0 or b>2:
continue
if b==0:
if(a==1):
print("我赢了")
k=k+1
elif a==2:
print("我输了")
s==s-1
else:
print("我们打平了")
elif b==1:
if a==2:
print("我赢了")
k=k+1
elif a==0:
print("我输了")
s=s-1
else:
print("我们打平了")
else:
if a==0:
print("我赢了")
k=k+1
elif a==1:
print("我输了")
s=s-1
else:
print("我们打平了")
if(s==0):
print ("计算机顺利")
else:
print("人类胜利了")
python复制代码
k=0
for i in range(2001,2101):
if k%10==0:
print()
if((i%4==0 and i%100!=0)or i%400==0):
print(i,end=" ")
k=k+1
else:
continue