-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab2.py
More file actions
48 lines (38 loc) · 1.13 KB
/
lab2.py
File metadata and controls
48 lines (38 loc) · 1.13 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class ListQ:
def __init__(self):
self.items = []
def isEmpty(self):
if self.items == []:
return True
else:
return False
def put(self, item):
self.items.insert(-1,item)
def get(self):
return self.items.pop(0)
"""class Sort(ListQ):
def __init__(self, unsortedList):
self.unsortedList = unsortedList
def magi(unsortedList):
# [3 1 4 2 5] [12 1 8 2 10 3 7 4 9 5 11 6 13]
unsortedList.put()
unsortedList[0] = get()"""
def sort(x):
def main():
question = input("Du har 5 kort. I vilken ordning vill du laegga dessa?")
numbers = question.split()
x = ListQ()
for i in numbers:
x.put(i)
print(x.isEmpty())
d = Sort(x)
print(d.magi())
# print("De kommer ut i ordningen: " + x[0] + x[1] + x[2] + x[3] +)
#if __name__== "main":
#Skapar en queue, init säger att den ska skapas tom. isEmpty kollar att den är tom.
#q = ListQ()
# if q.isEmpty():
# print("q.isEmpty() ger raett svar.")
# else:
# print("q.isEmpty() ger FEL svar".)
main()