zbush548 - 6 months ago 5x

Python Question

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)))

a.remove(max(a))

if min(a)>5:

print("The smallest number is", (min(a))), index.append(min(a)

a.append (0)

if min(a)>5

a.sort(['a'])

sum('a') / float(len('a')

a[2]

a[-3]

Answer

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`

.

Source (Stackoverflow)

Comments