【发布时间】:2022-11-25 11:57:08
【问题描述】:
if Profit<=10000:
print('Profit Rating is 1')
elif 10001<=Profit<=20000:
print('Profit Rating is 2')
elif 20001<=Profit<=30000:
print('Profit Rating is 3')
elif 30001<=Profit<=40000:
print('Profit Rating is 4')
elif 40001<=Profit<=50000:
print('Profit Rating is 5')
elif 50001<=Profit<=60000:
print('Profit Rating is 6')
elif 60001<=Profit<=70000:
print('Profit Rating is 7')
elif 70001<=Profit<=80000:
print('Profit Rating is 8')
elif 80001<=Profit<=90000:
print('Profit Rating is 9')
else:
print('Profit Rating is 10')
如果还有,请帮我删除上面的内容。 我尝试使用查找和映射,但它不起作用。
我想摆脱 if、elif 和 else。
【问题讨论】:
-
numpy.org/doc/stable/reference/generated/numpy.select.html 也许你可以使用 numpy select?
标签: python-3.x