def date():
year = int(input('年'))
mouse = int(input('月'))
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
if mouse in list1:
print('31天')
elif mouse in list2:
print('30')
else:
if year % 400 ==0:
print('29天')
else:
print('28天')
date()
===============================
年2000
月4
30
import random
num=int(input('请输入一个数字'))
num1=random.randint(0,2)
def he():
if num==num1:
print('true')
else:
print('false')
he()
=======================
请输入一个数字0
true
import random
me=int(input("请输入0:石头/1:剪刀/2:布"))
pc=random.randint(0,2)
l1=[(me==0 and pc==1),(me==1 and pc==2),(me==2 and pc==0)]
l2=[(me==0 and pc==0),(me==1 and pc==1),(me==2 and pc==2)]
def guss():
if me in l1:
print("you win !")
elif me in l2 :
print("please again !")
else :
print("you loose !")
guss()
====================
请输入0:石头/1:剪刀/2:布0
you win !
def function():
year = int(input('年'))
mounth = int(input('月'))
data = int(input('天'))
k = year % 100
j = year / 100
h = (data + (26 * (mounth + 1) / 10) + k + (k / 4) +(j/4) + 5 * j ) % 7
print('这一天是星期%d'%h)
function()
=================
年2013
月1
天25
这一天是星期5
def tishi():
a = int(input("请输入"))
b = int(input("请输入"))
c = int(input("请输入"))
zhaochang = (a + b + c)
if a + b > c and a + c > b and b + c > a:
print (zhaochang)
else :
print("错了")
tishi()
=================================
请输入1
请输入2
请输入3
错了