练习题![在这里插入图片描述](https://img-blog.csdnimg.cn/20200723171850876.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1J1YW5fSHVp,size_16,color_FFFFFF,t_70)
答:
>>> x = [i for i in range(1500,2700) if i%7==0 and i%5==0]
>>> print(x)
[1505, 1540, 1575, 1610, 1645, 1680, 1715, 1750, 1785, 1820, 1855, 1890, 1925, 1960, 1995, 2030, 2065, 2100, 2135, 2170, 2205, 2240, 2275, 2310, 2345, 2380, 2415, 2450, 2485, 2520, 2555, 2590, 2625, 2660, 2695]
>>>
答:
v1,v2,t,s,L = map(int,input("请输入用空格隔开的五个正数(兔子的速度v1、乌龟的速度v2、兔子领先t米休息s秒、赛道的长度L):").split())
if not((0<v1<=100 and 0<v2<=100) and (0<t<=300) and (0<=s<=10) and (0<L<=10000)):
print("输入错误!")
turtle = 0
rabbit = 0
time = 0
while (turtle<L) and (rabbit<L):
if rabbit - turtle >=t: #兔子休息
time += s
turtle += v2 * s
else:
rabbit += v1
turtle += v2
time += 1
if turtle<rabbit:
print('R')
elif turtle==rabbit:
print('D')
else:
print('R')
print(time)