题解 | #【模板】循环队列#
【模板】循环队列
https://www.nowcoder.com/practice/0a3a216e50004d8bb5da43ad38bcfcbf
s = input().split()
n = int(s[0])
num = int(s[1])
st = []
for i in range(num):
l = input().split(' ')
if l[0]=='push':
if len(st) < n:
st.append(int(l[1]))
else:
print('full')
elif st == []:
print('empty')
else :
if l[0]=='pop':
print(st.pop(0))
elif l[0]=='front':
print(st[0])
注意处理输入的时候要split 否则就是一整个的string了

基恩士成长空间 419人发布