# Function starts_with() - Finds if list 1 starts with list 2 : )
def starts_with(list1, list2):
count = 0
if length (list1) >= length(list2):(error)
for var in range(length(list2):(error)
if var == list2[var]: (error)
count(error) += 1
else:
return false
if count = length(list2):
return true
else:
return false
This code returns syntax errors at the marked points. Length does the same thing as len, and I realize that I am a horrible programmer.
Best How To :
After removing those (error)
markers, there are two actual syntax errors in your script:
- Missing closing parens
)
in for var in range(length(list2):
- Assignment
=
instead of equality check ==
in if count = length(list2):
Apart from that, there are some other issues, but those are not syntax errors:
- Should
length
be len
? Even if you have a function called length
, that does the same thing as len
, why not use len
in the first place?
- Unless you defined "aliases" for those, too,
true
and false
should be True
and False
For the other places, I can't see what's wrong there, but those might be follow-up errors that are resolved once you fix those other ones. If that does not fix it:
- Check your indentation; make sure to use only tabs or spaces, but not a mixture
- Post the actual Syntax Error you are getting