nononoyes
发表于 2020-6-11 10:44:24
import test
def tickets(people):
sale = []
for i in people:
#print(i)
ifi == 25:
sale.append(i)
if i == 50:
if sale.count(25)>=1:
sale.remove(25)
sale.append(i)
else:
return "NO"
if i == 100:
if sale.count(50)>= 1 and sale.count(25)>=1:
sale.remove(50)
sale.remove(25)
sale.append(i)
elif sale.count(25)>=3:
sale.remove(25)
sale.remove(25)
sale.remove(25)
sale.append(i)
else:
return "NO"
return "YES"
test.assert_equals(tickets(), 'YES')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'YES')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'YES')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'YES')
test.assert_equals(tickets(),'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
test.assert_equals(tickets(), 'NO')
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
Success!
小陨aoq
发表于 2020-7-27 14:01:42
学习一下
wwwwwise
发表于 2021-3-1 16:21:19
1