Skip to content
Snippets Groups Projects
Commit 9fe58470 authored by s2299100's avatar s2299100
Browse files

tried to make it into a class

parent c1111ea2
No related branches found
No related tags found
No related merge requests found
......@@ -6,24 +6,23 @@ if __name__ != "__main__":
#if this file is run in script mode, it will assign arbitrary testing values in order to check whether the code is running correctly
elif __name__ == "__main__":
i = 2
sequence1 = [0, 2, 5]
sequence2 = [2, 3, 1]
sequence3 = [0, 2]
sequencelist = [sequence1, sequence2, sequence3]
sequencelist = [[0, 2, 5], [2, 3, 1], [0, 2]]
currentinput = [0, 2]
currentinputlength = len(currentinput)
currentsequence = sequencelist[i]
currentsequencelength= len(currentsequence)
#function that checks if the input matches the sequence
def checkcorrect():
if currentsequencelength != currentinputlength:
correct = False
else:
for c in range (len(currentsequence)):
if currentsequence[c] != currentinput[c]:
correct = False
else:
correct = True
print (correct)
if __name__ == "__main__":
checkcorrect()
\ No newline at end of file
'''this class deals with all the functions for the current sequence'''
class Sequence:
#function that checks if the input matches the sequence
def checkcorrect():
if currentsequencelength != currentinputlength:
correct = False
else:
for c in range (len(currentsequence)):
if currentsequence[c] != currentinput[c]:
correct = False
else:
correct = True
print(correct)
if __name__ == "__main__":
checkcorrect()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment