FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
practice-python/queue/queue-array.py at main · eujuliu/practice-python · GitHub
eujuliu
/
practice-python
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
practice-python
/
queue
/
queue-array.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (20 loc) · 545 Bytes
Breadcrumbs
practice-python
/
queue
/
queue-array.py
Copy path
File metadata and controls
29 lines (20 loc) · 545 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class
Queue
:
def
__init__
(
self
)
->
None
:
self
.
values
=
[]
def
__repr__
(
self
)
->
str
:
return
" -> "
.
join
(
map
(
lambda
value
:
str
(
value
),
self
.
values
))
def
enqueue
(
self
,
value
:
any
)
->
None
:
self
.
values
.
append
(
value
)
def
dequeue
(
self
):
return
self
.
values
.
pop
(
0
)
def
empty
(
self
):
self
.
values
=
[]
return
self
queue
=
Queue
()
queue
.
enqueue
(
1
)
queue
.
enqueue
(
2
)
queue
.
enqueue
(
3
)
queue
.
enqueue
(
"4"
)
queue
.
dequeue
()
queue
.
enqueue
({
"id"
:
1231312
,
"value"
:
"Hello"
})
print
(
queue
)
Back
|
FazBrowse Home
|
New Git URL