赞
踩
- set1 = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31]
- set2 = [2,3,6,7,10,11,14,15,18,19,22,23,26,27,31]
- set3 = [4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31]
- set4 = [8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31]
- set5 = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
- bir = int(input("请输入你的生日日期:"))
- for i in set1 :
- if i == bir :
- print("出现在第一个数字集合set1中,输出数字集合首数字:1")
-
- for i in set2 :
- if i == bir :
- print("出现在第一个数字集合set2中,输出数字集合首数字:2")
-
- for i in set3 :
- if i == bir :
- print("出现在第一个数字集合set3中,输出数字集合首数字:4")
-
- for i in set4 :
- if i == bir :
- print("出现在第一个数字集合set4中,输出数字集合首数字:8")
-
- for i in set5 :
- if i == bir :
- print("出现在第一个数字集合set5中,输出数字集合首数字:16")
运行结果:
- tizhong = float(input("请输入以磅为单位的体重:"))
- shengao = float(input("请输入以英寸为单位的身高:"))
- BMI = tizhong / shengao
- if BMI >= 30.0 :
- print("肥痴")
- elif BMI >= 25.0 :
- print("超重")
- elif BMI >= 18.5 :
- print("标准")
- else:
- print("偏瘦")
运行结果:
- year = int(input("请输入一个年份:"))
- if year % 4 ==0 and year % 100 !=0:
- print("此年是闰年!")
- elif year % 400 == 0:
- print("此年是闰年!")
- else:
- print("此年不是闰年!")
运行结果:
- import random
- p = random.randint(10,99)
- q = int(input("请输入两位数:"))
- a = q %10
- b = q//10%10
- c = p%10
- d = p//10%10
- if q == p :
- print("恭喜你中奖了!奖金10000$")
- elif (a == c or a==d ) and (b==c or b==d):
- print("恭喜你中奖了!奖金3000$")
- elif a == c or a==d or b==c or b==d :
- print("恭喜你中奖了!奖金1000$")
- else:
- print("很遗憾未中奖!")
运行结果:
- a,b,c= eval(input("请输入a,b,c的值:"))
- p = b**2-4*a*c
- if p > 0:
- r1 = (-b+(p*
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。