主要语法
- if …… else
- if……elif……elif……else
- 条件嵌套,同等缩进为同一条件结构
- random函数
Case1 :氪佬和非氪
实现1 : if……else……判断
实现2 : 选择结构
Case2 :根据玩家氪金数量划分大中小R
Case3 :加入条件嵌套,在判断玩家氪度的同时判断玩家肝度
'''制定划分大中小R的标准,逐级判断是否符合条件,最后没有满足任何一个付费档位的就是免费玩家。 并且返回该玩家的充值金额
氪度分档标准:
大R:(647,+∞)
中R:(100,647]
小R:(6,100]
微氪:(0,6]
免费
肝度分档标准:日平均游戏时长
肝佬:3h+
休闲玩家:小于3h
'''
pay_amount = int(input('please input how much dolla have the user pay:'))
day_duration = int(input('please input how much hour have the user spend in our game:'))
if pay_amount >647:
print(f'大R!The user have pay {pay_amount}$')
if day_duration >=3 :
print(f'And the user is a 肝佬, who daily use {day_duration} in our game')
else :
print(f'But the user is a 休闲佬, who daily use {day_duration} in our game')
elif pay_amount > 100 and pay_amount<= 647:
print(f'中R!The user have pay {pay_amount}$')
if day_duration >=3 :
print(f'And the user is a 肝佬, who daily use {day_duration} in our game')
else :
print(f'But the user is a 休闲佬, who daily use {day_duration} in our game')
elif pay_amount > 6 and pay_amount<= 100:
print(f'小R!The user have pay {pay_amount}$')
if day_duration >=3 :
print(f'And the user is a 肝佬, who daily use {day_duration} in our game')
else :
print(f'But the user is a 休闲佬, who daily use {day_duration} in our game')
elif pay_amount > 0 and pay_amount<= 6:
print(f'微氪!The user have pay {pay_amount}$')
if day_duration >=3 :
print(f'And the user is a 肝佬, who daily use {day_duration} in our game')
else :
print(f'But the user is a 休闲佬, who daily use {day_duration} in our game')
else:
print('there is no pay in our game')
if day_duration >=3 :
print(f'But the user is a 肝佬, who daily use {day_duration} in our game')
else :
print(f'And the user is a 休闲佬, who daily use {day_duration} in our game')
Case4: AB/奇偶测试选择玩家
通过help函数查看randint函数,可以看到a,b范围是两个闭区间