python 3.x - IDLE returning syntax errors for no reason that I can discern -


# function starts_with() - finds if list 1 starts list 2 : )     def starts_with(list1, list2):     count = 0     if length (list1) >= length(list2):(error)         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 @ marked points. length same thing len, , realize horrible programmer.

after removing (error) markers, there two actual syntax errors in script:

  1. missing closing parens ) in for var in range(length(list2):
  2. assignment = instead of equality check == in if count = length(list2):

apart that, there other issues, not syntax errors:

  • should length len? if have function called length, same thing len, why not use len in first place?
  • unless defined "aliases" those, too, true , false should true , false

for other places, can't see what's wrong there, might follow-up errors resolved once fix other ones. if not fix it:

  • check indentation; make sure use tabs or spaces, not mixture
  • post actual syntax error getting

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -