zbush548 zbush548 - 2 years ago 113
Python Question

Array Syntax Error

It says that I have a syntax error. But I don't see whats wrong. It's on the line where it says a.append. I'm so confused. I apologize i'm a newbie. I need some help. I'm pretty sure I have more than one. But the first one is on a.append(0)

def invalidsyntax(a):
if max(a)>20:
print("The highest number is in position", a.index(max(a)))
if min(a)>5:
print("The smallest number is", (min(a))), index.append(min(a)
a.append (0)
if min(a)>5
sum('a') / float(len('a')

Answer Source

Count your parentheses:

print("The smallest number is", (min(a))), index.append(min(a)
     ^                          ^   ^ ^^^
     |                          |   |_|||
     |                          |______||

That may or may not actually be the error (depending on whether you are using Python 2 or Python 3), but there is still a mismatch later in the same line, in the call to index.append.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download