#3.1
print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n")
number = int(input("请输入你认为符合条件的数: "))
if number%3 == 2 and number%5 == 3 and number%7 == 2:
print(number,"符合条件:三三数之剩二,五五数之剩三,七七数之剩二")
#3.2
print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n")
number = int(input("请输入瑛姑给出的数: "))
if number%3 == 2 and number%5 == 3 and number%7 == 2:
print(number,"符合条件")
else:
print(number,"不符合条件")
#3.3
print("在古希腊神话中,玫瑰集爱情与美丽于一身,所以人们常用玫瑰来表达爱意。")
print("但是不同朵数的玫瑰花代表的含义是不同的。\n")
# 获取用户输入的朵数,并转换为整形
number = int(input("输入你想送几朵玫瑰花,小默会告诉你含义:"))
if number == 1: # 判断输入的数是否为1,代表一朵
# 如果等于1则输出提示信息
print("1朵:你是我的唯一!")
elif number == 3:
print("3朵:I LOVE You!")
elif number == 10:
print("10朵:十全十美!")
elif number == 99:
print("99朵:天长地久!")
elif number == 108:
print("108:求婚!")
else:
print("小默也不知道了!可以考虑送1朵、3朵、10朵、99朵或108朵哟!")
#3.4
print("\n为了你和他人安全,严禁酒后开车!\n")
proof = int(input("请输入每100毫升血液的酒精含量:"))
if proof <20:
print("\n你还不构成饮酒行为,可以开车,但要注意安全!")
else:
if proof <80:
print("\n已经达到酒后驾驶标准,请不要开车!")
else:
print("\n已经达到醉酒驾驶标准,千万不要开车!")
# 3.5
print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n")
none = True
number = 0
while none:
number += 1
if number%3 ==2 and number%5 ==3 and number%7 ==2:
print("答曰:这个数是",number)
none = False
# 3.6
print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n")
for number in range(100):
if number%3 ==2 and number%5 ==3 and number%7 ==2:
print("答曰:这个数是",number)
#3.7
for i in range(9,0,-1):
for j in range(i,0,-1):
print("%d * %d = %2d" % (i,j,i*j), end="\t")
print(" ")
# 3.8
print("今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问几何?\n")
for number in range(100):
if number%3 ==2 and number%5 ==3 and number%7 ==2:
print("答曰:这个数是",number)
break
# 3.9
total = 99
for number in range(1,100):
if number % 7==0:
continue
else:
string = str(number)
if string.endswith('7'):
continue
total -= 1
print("从1数到99共拍腿",total,"次。")
#实战一
for i in range(100):
print("""
能量查询请输入能量来源! 退出程序请输入0
能量来源如下:
生活缴费、行走捐、共享单车、线下支付、网络购票
""")
tip = input() # 提示输入内容
if tip == '生活缴费' :
print('262 g')
continue
elif tip == '行走捐' :
print('200 g')
continue
elif tip == '共享单车' :
print ('159 g')
continue
elif tip == '线下支付' :
print('5 g')
continue
elif tip == '网络购票' :
print('180 g')
continue
elif tip == '0' :
print('已退出!')
break
else :
continue
#实战二
import random
import sys
ran = random.randint(1, 10)
print('猜数字游戏')
print('请输入1~10之间的任意一个数:')
while True:
guess = int(input())
if guess == -1:
print('游戏结束')
sys.exit(0)
elif guess < ran:
print('太小,请重新输入:')
elif guess > ran:
print('太大,请重新输入:')
else:
print('恭喜你,你赢了,猜中的数字是:' + str(guess))
break
#实战三
import sys
print('跳一跳')
print('欢迎回来,请开始游戏...')
print('请输入(中心、音乐块、微信支付块):')
while True:
str = input('请输入:')
if str == '中心':
print('您的分数为:2')
elif str == '音乐块':
print('您的分数为:32')
elif str == '微信支付块':
print('您的分数为:42')
else:
print('退出游戏')
sys.exit(0)
#实战四
import random
import sys
print('------10086查询功能------')
print('输入1,查询当前余额')
print('输入2,查询当前剩余流量')
print('输入3,查询当前剩余通话')
print('输入0,退出自助查询系统!')
while True:
ran = random.randint(1, 1000)
n = int(input())
if n == 1:
print(f'当前余额为:{ran}元')
elif n == 2:
print(f'当前剩余流量为:{ran}G')
elif n == 3:
print(f'当前剩余通话为:{ran}分钟')
elif n == 0:
print('退出自助查询系统!')
sys.exit(0)